Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
using namespace std; #define INF INT_MAX #define LINF LLONG_MAX #define forin(data) for(auto &i : data) #define debug(x) cerr << #x << " = " << x << endl; using ll = long long; using pi = pair
; using vi = vector
; using vii = vector
; using vl = vector
; void init(){ #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); freopen("log.txt", "w", stderr); #else cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); #endif } bool sortStartTime(vi &v1, vi &v2){ return v1[0] < v2[0]; } bool sortIndex(vi &v1, vi &v2){ return v1[2] < v2[2]; } int main(){ init() int tc; cin >> tc; for(int i=1; i<=tc; i++){ bool check = true; int n, index = 0; cin >> n; string ans = ""; vii arr(n, vi(4)); for(int i=0; i
> arr[i][0] >> arr[i][1]; arr[i][2] = i; } sort(arr.begin(), arr.end(), sortStartTime); int j, c; j = c = -1; for(int i=0; i
= j){ j = -1; } if(arr[i][0] >= c){ c = -1; } if(j != -1 && c != -1){ check = false; break; } if(j == -1){ j = arr[i][1]; arr[i][3] = 0; //ans += "J"; //cout << "J Assigned! Cost: " << j << endl; }else{ c = arr[i][1]; arr[i][3] = 1; //ans += "C"; //cout << "C Assigned! Cost: " << c << endl; } } sort(arr.begin(), arr.end(), sortIndex); if(!check){ ans = "IMPOSSIBLE"; }else{ for(int i=0; i
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)