제출 #56052

#제출 시각아이디문제언어결과실행 시간메모리
56052win11905로봇 (IOI13_robots)C++11
39 / 100
3063 ms9124 KiB
#include "robots.h" #include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; const int INF = 1e6+1; const int INF2 = 2e9+1; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X + A), sort(Y, Y + B); int l = 1, r = 1e6+1; while(l < r) { int m = l + r >> 1; vector<pii> V; for(int i = 0; i < T; ++i) V.emplace_back(W[i], S[i]); sort(V.begin(), V.end()); for(int i = 0; i < A; ++i) { int z = m; while(z) { bool st = true; for(int j = V.size() - 1; ~j; --j) { if(V[j].x < X[i]) { V.erase(V.begin() + j); st = false; z--; break; } } if(st) break; } } sort(V.begin(), V.end(), [&](const pii &a, const pii &b) { return a.y < b.y; }); for(int i = 0; i < B; ++i) { int z = m; while(z) { bool st = true; for(int j = V.size() - 1; ~j; --j) { if(V[j].y < Y[i]) { V.erase(V.begin() + j); st = false; z--; break; } } if(st) break; } } if(V.empty()) r = m; else l = m+1; } if(r == INF) return -1; return r; }

컴파일 시 표준 에러 (stderr) 메시지

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:15:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         int m = l + r >> 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...