Submission #993337

#TimeUsernameProblemLanguageResultExecution timeMemory
993337RifalRobots (IOI13_robots)C++14
0 / 100
1 ms348 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; const int Max = 1e6 + 5; const int M = 5e4 + 5; typedef long long ll; vector<pair<int,int>> v; int a[M], b[M]; int siza, sizb; bool sol(int mid) { int cnt = 0; int indx = siza-1; // cout << mid << 'p' << endl; for(int i = v.size()-1; i >= 0; i--) { // cout << v[i].first << ' ' << i << ' ' << indx << ' ' << a[indx] << 'o' << endl; if(indx < 0) return false; if(v[i].first >= a[indx]) { return false; } else { cnt++; // cout << cnt << 'i' << endl; if(cnt == mid) { cnt = 0; indx--; } } } //cout << 'Y' << endl; return true; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { for(int i = 0; i < A; i++) a[i] = X[i]; for(int i = 0; i < B; i++) b[i] = Y[i]; siza = A; sizb = B; sort(a,a+A); sort(b,b+B); for(int i = 0; i < T; i++) { v.push_back({W[i],0}); } sort(v.begin(),v.end()); int l = 1, r = T + 5; int ans = -1; while(l < r) { int mid = (l+r)/2; if(sol(mid) == true) { r = mid-1; ans = mid; } else { l = mid+1; } } return ans; }
#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...