제출 #993416

#제출 시각아이디문제언어결과실행 시간메모리
993416lacito로봇 (IOI13_robots)C++14
0 / 100
1 ms2392 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<ll,ll>> v; ll a[M], b[M]; int siza, sizb; bool sol(ll mid) { ll 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()); ll l = 0, r = 10000000000; ll ans = -1; while(l < r) { ll 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...