제출 #309340

#제출 시각아이디문제언어결과실행 시간메모리
309340Hehehe로봇 (IOI13_robots)C++14
100 / 100
1849 ms24364 KiB
#include<bits/stdc++.h> //:3 using namespace std; typedef long long ll; #define all(a) (a).begin(), (a).end() #define ff first #define ss second #define pb push_back #define mp make_pair #define pi pair<int, int> #define sz(x) (int)((x).size()) //#define int long long #include "robots.h" const int dx[] = {0, 1, 0, -1}; const int dy[] = {1, 0, -1, 0}; const ll inf = 2e6; const ll mod = 1e9 + 7; const int N = 3e6 + 11; const ll INF64 = 3e18 + 1; const double eps = 1e-14; const double PI = acos(-1); //ifstream in(".in"); //ofstream out(".out"); int A, B, T, *X, *Y, *W, *S; pi P[N]; bool f(int m){ priority_queue<int> q; int j = 0; for(int i = 0; i < A; i++){ for(;j < T && P[j].ff < X[i];){ q.push(P[j].ss); j++; } for(int k = 0; k < m && sz(q); k++)q.pop(); } for(int i = j; i < T; i++)q.push(P[i].ss); for(int i = B - 1; i >= 0; i--){ for(int j = 0; j < m && sz(q); j++){ if(Y[i] <= q.top())return 0; q.pop(); } } return (!sz(q)); } int putaway(int AA, int BB, int TT, int XX[], int YY[], int WW[], int SS[]) { A = AA, B = BB, T = TT, X = XX, Y = YY, W = WW, S = SS; sort(X, X + A); sort(Y, Y + B); for(int i = 0; i < T; ++i) if(W[i] >= X[A - 1] && S[i] >= Y[B - 1]) return -1; for(int i = 0; i < T; i++){ P[i] = {W[i], S[i]}; } sort(P, P + T); int l = 1, r = T, ans = T; while(l < r){ int mid = (l + r) >> 1; if(f(mid))r = mid, ans = mid;else l = mid + 1; } return l; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:65:20: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   65 |  int l = 1, r = T, ans = T;
      |                    ^~~
#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...