제출 #347386

#제출 시각아이디문제언어결과실행 시간메모리
347386Kerim로봇 (IOI13_robots)C++17
100 / 100
1821 ms24616 KiB
#include "robots.h" #include "bits/stdc++.h" #define MAXN 1000009 #define INF 1000000007 #define mp(x,y) make_pair(x,y) #define all(v) v.begin(),v.end() #define pb(x) push_back(x) #define wr cout<<"----------------"<<endl; #define ppb() pop_back() #define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++) #define ff first #define ss second #define my_little_dodge 46 #define debug(x) cerr<< #x <<" = "<< x<<endl; using namespace std; typedef long long ll; typedef pair<int,int> PII; template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} PII arr[MAXN]; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X,X+A);sort(Y,Y+B);reverse(Y,Y+B); for(int i=0;i<T;i++)arr[i]=mp(W[i],S[i]); sort(arr,arr+T);int st=1,en=T+1; while(st<en){ priority_queue<int>q; int mid=(st+en)>>1,p=0,f; for(int i=0;i<A;i++){ while(p<T and arr[p].ff<X[i])q.push(arr[p++].ss);f=mid; while(!q.empty() and f>=1)f--,q.pop(); }int ok=1; while(p<T)q.push(arr[p++].ss); for(int i=0;ok and !q.empty() and i<B;i++){ f=mid; while(!q.empty() and f>=1){ if(q.top()>=Y[i]){ ok=0;break; }q.pop();f--; } }ok&=(q.empty()); if(ok)en=mid; else st=mid+1; } if(st==T+1)return -1;return st; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:30:4: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   30 |    while(p<T and arr[p].ff<X[i])q.push(arr[p++].ss);f=mid;
      |    ^~~~~
robots.cpp:30:53: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   30 |    while(p<T and arr[p].ff<X[i])q.push(arr[p++].ss);f=mid;
      |                                                     ^
robots.cpp:45:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   45 |  if(st==T+1)return -1;return st;
      |  ^~
robots.cpp:45:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   45 |  if(st==T+1)return -1;return st;
      |                       ^~~~~~
#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...