제출 #1036444

#제출 시각아이디문제언어결과실행 시간메모리
1036444clementine로봇 (IOI13_robots)C++17
0 / 100
143 ms17340 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; bool can(int time, int A, vector<int> tots) { for(int i = 0; i < A; i++) { if(tots[i] > time) { tots[i+1] += tots[i] - time; } } if(tots[A] !=0) { return false; } return true; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { vector<int> Xs(X, X+A); vector<int> Ys(Y, Y+B); vector<int> Ws(W, W+T); vector<int> Ss(S, S + T); sort(Xs.begin(), Xs.end()); sort(Ws.begin(), Ws.end()); int x = 0; int total = 0; int i = 0; Xs.push_back(INT32_MAX); vector<int> tots; if(Xs[A-1] < Ws.back()) { return -1; } while(i!=T) { if(Ws[i] < Xs[x]) { total ++; i++; } else { tots.push_back(total); total = 0; x +=1; } } tots.push_back(total); tots.push_back(0); int l = 1; int r = 1000006; while(l != r) { int mid = (l + r)/2; if(can(mid, A, tots)) { r = mid; } else { l = mid + 1; } } return l; //return can(4, A, tots); }
#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...