제출 #957596

#제출 시각아이디문제언어결과실행 시간메모리
957596vjudge1Robots (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define se second #define fi first int putaway(int a, int b, int t, int x[], int y[],int w[], int s[]) { vector <pair<int,int>> vec; for(int i=0;i<a;i++){ vec.pb({x[i],1}); } for(int i=0;i<t;i++){ vec.pb({w[i],s[i]}); } sort(vec.begin(),vec.end()); sort(y.begin(),y.end(),greater<int>()); int l=0; int r=t+1; int ans=-1; while(l<r){ int md=(l+r)>>1; bool ok=1; priority_queue<pair<int,int>>pq; for(int i=0;i<(int)vec.size();i++){ if(vec[i].se==1){ for(int j=0;j<md;j++){ if(pq.size())pq.pop(); } } else{ pq.push(vec[i]); } } priority_queue<int> pq2; while(pq.size()){ pq2.push(pq.top().se); pq.pop(); } for(int i=0;i<b;i++){ if(!pq2.size())break; if(pq2.top()>=y[i]){ ok=0; break; } else{ for(int j=0;j<md;j++){ if(pq2.size())pq2.pop(); } } } if(ok){ ans=md; r=md; } else{ l=md+1; } } return ans; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:17:12: error: request for member 'begin' in 'y', which is of non-class type 'int*'
   17 |     sort(y.begin(),y.end(),greater<int>());
      |            ^~~~~
robots.cpp:17:22: error: request for member 'end' in 'y', which is of non-class type 'int*'
   17 |     sort(y.begin(),y.end(),greater<int>());
      |                      ^~~