제출 #223602

#제출 시각아이디문제언어결과실행 시간메모리
223602staniewzki로봇 (IOI13_robots)C++17
100 / 100
1942 ms24368 KiB
#include<bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) using PII = pair<int, int>; #include "robots.h" int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X + A), sort(Y, Y + B); vector<PII> pts(T); REP(i, T) pts[i] = {W[i], S[i]}; sort(pts.begin(), pts.end()); auto check = [&](int q) { priority_queue<int> Q; int cur = 0; REP(i, A + 1) { while(cur < size(pts) && (i == A || pts[cur].first < X[i])) Q.emplace(pts[cur++].second); if(i != A) REP(j, q) { if(Q.empty()) break; Q.pop(); } } for(int i = B - 1; i >= 0; i--) { REP(j, q) { if(Q.empty()) break; if(Q.top() >= Y[i]) return false; Q.pop(); } } return Q.empty(); }; if(!check(T)) return -1; int l = 1, r = T; while(l < r) { int m = (l + r) / 2; if(check(m)) r = m; else l = m + 1; } return l; }

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

robots.cpp: In lambda function:
robots.cpp:21:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(cur < size(pts) && (i == A || pts[cur].first < X[i]))
          ~~~~^~~~~~~~~~~
#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...