Submission #221813

#TimeUsernameProblemLanguageResultExecution timeMemory
221813patrikpavic2Robots (IOI13_robots)C++17
14 / 100
269 ms15916 KiB
/** * user: ppavic * fname: Patrik * lname: Pavić * task: robots * score: 14.0 * date: 2019-07-03 13:44:35.598305 */ #include "robots.h" #include <cstdio> #include <cstring> #include <ctime> #include <vector> #include <algorithm> #define X first #define Y second #define PB push_back using namespace std; typedef pair < int, int > pii; typedef vector < int > vi; typedef vector < pii > vp; typedef long long ll; const int N = 1e6 + 500; const int INF = 0x3f3f3f3f; vi r,s; int pref[N]; int A, B, T; bool check(int K){ for(int i = 0;i <= A;i++){ if((ll)K * (A - i) < (ll)pref[i]) return 0; } return 1; } int putaway(int AA, int BB, int TT, int X[], int Y[], int W[], int S[]) { A = AA; B = BB; T = TT; for(int i = 0;i < A;i++) r.PB(X[i]); sort(r.begin(), r.end()); for(int i = 0;i < T;i++){ W[i] = upper_bound(r.begin(), r.end(), W[i]) - r.begin(); pref[W[i]]++; } for(int i = A;i >= 0;i--){ pref[i] += pref[i + 1]; } int ans = 0; for(int i = 25;i >= 0;i--) if(!check(ans + (1 << i))) ans += (1 << i); if(ans + 1 == (1 << 26)) return -1; return ans + 1; }
#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...