제출 #30052

#제출 시각아이디문제언어결과실행 시간메모리
30052osmanorhan로봇 (IOI13_robots)C++14
76 / 100
1999 ms14852 KiB
#include "robots.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define rt insert #define st first #define nd second #define ll long long #define pii pair < int , int > #define DB printf("debug\n"); using namespace std; int wrc,src,tn; vector < int > wr; vector < int > sr; vector < pii > tws; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { wrc=A;src=B;tn=T; for(int i=0;i<tn;i++){ tws.pb(mp(W[i],S[i])); } sort(tws.begin(),tws.end()); for(int i=0;i<wrc;i++)wr.pb(X[i]); for(int i=0;i<src;i++)sr.pb(Y[i]); sort(wr.begin(),wr.end()); sort(sr.begin(),sr.end());reverse(sr.begin(),sr.end()); int l=0,r=2000005,m,ans=1e7; priority_queue < int > pq; while(l<r){ m=(l+r)/2; pq = priority_queue < int > (); //printf("l=%d r=%d m=%d\n",l,r,m); int twsind=0,tswind=0; for(int i=0;i<wrc;i++){// eklicegimiz robotu aldik //printf(" i=%d wrc=%d\n",i,wr[i]); for(int j=twsind;tws[j].st<wr[i] && j<tn;j++){//eklicemiz robota kalan olan toylari ekledik //printf(" j=%d tws= %d %d\n",j,tws[j].st,tws[j].nd); pq.push(tws[j].nd); twsind=j+1; } for(int j=0;j<m && pq.size();j++){ //printf(" %d pop\n",pq.top()); pq.pop();// m kadarlari pq dan attik } } for(int j=twsind;j<tn;j++){//eklicemiz robota kalan olan toylari ekledik //printf("j=%d tws= %d %d\n",j,tws[j].st,tws[j].nd); pq.push(tws[j].nd); } for(int i=0;i<src;i++){ for(int j=0;j<m;j++){ if(pq.size()){ if(pq.top()<sr[i]){ pq.pop(); } else if(r==2000005) return -1; } } } if(pq.size()){ l=m+1; } else{ r=m; ans=min(ans,m); } } return ans; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:33:16: warning: unused variable 'tswind' [-Wunused-variable]
   int twsind=0,tswind=0;
                ^
#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...