제출 #67225

#제출 시각아이디문제언어결과실행 시간메모리
67225Vahan로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include "robots.h" #include<set> #include<vector> #include<cstdio> #include<string> #include<algorithm> #include<iostream> using namespace std; vector<pair<int,int> > v; multiset<int> se; int a,b,t,x[2000000],y[2000000],w[2000000],s[2000000]; int kar(int p) { se.clear(); for(int i=0;i<t+a;i++) { int e=v[i].first; int f=v[i].second; if(f==-1) { int u=0; set<int>::iterator it; while(se.size()>0 && u<p) { u++; it=se.end(); it--; se.erase(it); } } else se.insert(f); } for(int i=0;i<b;i++) { int u=0; while(se.size()>0 && (*se.begin())<y[i] && u<p) { se.erase(se.begin()); u++; } } if(se.size()==0) return 1; else return 0; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { memcpy(x,X,A*sizeof(int)); memcpy(y,Y,B*sizeof(int)); memcpy(w,W,T*sizeof(int)); memcpy(s,S,T*sizeof(int)); a=A; b=B; t=T; sort(x,x+a); sort(y,y+b); for(int i=0;i<T;i++) v.push_back(make_pair(w[i],s[i])); for(int i=0;i<a;i++) v.push_back(make_pair(x[i],-1)); sort(v.begin(),v.end()); int l=1,r=T; while(l!=r) { int mid=(l+r)/2; if(kar(mid)) r=mid; else l=mid+1; } if(kar(l)) return l; else return -1; }

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

robots.cpp: In function 'int kar(int)':
robots.cpp:17:13: warning: unused variable 'e' [-Wunused-variable]
         int e=v[i].first;
             ^
robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:49:5: error: 'memcpy' was not declared in this scope
     memcpy(x,X,A*sizeof(int));
     ^~~~~~
robots.cpp:49:5: note: suggested alternative: 'wmemcpy'
     memcpy(x,X,A*sizeof(int));
     ^~~~~~
     wmemcpy