제출 #787647

#제출 시각아이디문제언어결과실행 시간메모리
787647drdilyor로봇 (IOI13_robots)C++17
0 / 100
1 ms468 KiB
#include "robots.h" #include <algorithm> #include <iostream> #include <vector> #include <cassert> using namespace std; int putaway(int a, int b, int t, int x[], int y[], int w[], int s[]) { assert(b == 0); sort(x, x + a); sort(w, w + t); auto check = [&](int time)->bool { int cnt = 0; int toy = 0; for (int robot = 0; robot < a; robot++) { while (toy < t && x[robot] >= w[toy]) { toy++; cnt++; } cnt = max(cnt - time, 0); } return cnt == 0 && toy == t; }; int l = -1, r = t +1; while (l < r - 1) { int mid = (l + r) / 2; if (check(mid)) r = mid; else l = mid; } return r == t+1 ? -1 : r; }
#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...