Submission #404680

#TimeUsernameProblemLanguageResultExecution timeMemory
404680peuchRobots (IOI13_robots)C++17
14 / 100
204 ms19296 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 10; int n, m, t; int x[MAXN], y[MAXN]; pair<int, int> v[MAXN]; int bb(); bool test(int val); int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { n = A, m = B, t = T; for(int i = 0; i < t; i++) v[i] = make_pair(W[i], S[i]); for(int i = 0; i < n; i++) x[i] = X[i]; for(int i = 0; i < m; i++) y[i] = Y[i]; sort(v, v + t); sort(x, x + n); sort(y, y + m); reverse(v, v + t); reverse(x, x + n); reverse(y, y + m); return bb(); } int bb(){ int ini = 1, fim = t; if(!test(t + 1)) return -1; while(ini != fim){ int mid = (ini + fim) >> 1; if(test(mid)) fim = mid; else ini = mid + 1; } return ini; } bool test(int val){ int naoPego = 0; for(int i = 0; i < n; i++){ if(v[naoPego].first >= x[i]) return 0; naoPego += val; if(naoPego >= t) return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...