제출 #1088693

#제출 시각아이디문제언어결과실행 시간메모리
1088693VMaksimoski008로봇 (IOI13_robots)C++17
90 / 100
3070 ms23480 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { vector<array<int, 2> > v; for(int i=0; i<T; i++) v.push_back({ W[i], S[i] }); sort(X, X + A); sort(Y, Y + B); sort(v.begin(), v.end()); int l=1, r=T, ans=-1; while(l <= r) { int mid = (l + r) / 2; bool ok = 1; priority_queue<int> pq; int j = 0; for(int i=0; i<A; i++) { while(j < T && v[j][0] < X[i]) pq.push(v[j][1]), j++; for(int k=0; k<mid&&!pq.empty(); k++) pq.pop(); } vector<int> vec; for(int i=j; i<T; i++) pq.push(v[i][1]); for(int i=B-1; i>=0; i--) for(int k=0; k<mid&&!pq.empty(); k++) if(pq.top() < Y[i]) pq.pop(); if(pq.empty()) ans = mid, r = mid - 1; else l = mid + 1; } return ans; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:16:14: warning: unused variable 'ok' [-Wunused-variable]
   16 |         bool ok = 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...