제출 #1060706

#제출 시각아이디문제언어결과실행 시간메모리
1060706vjudge1로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int N=1000100; const int R=100000; int a,b,t; vector<int>x; vector<int>y; vector<int>w; vector<int>s; vector<pair<int,int>> WS; int itpass(int md, priority_queue<pair<int,int>>pq){ } int binary(int mn, int md, int mx){ priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>pq; vector<int>tosmall; while(mx!=md){ //cout<<mn<<" "<<md<<" "<<mx<<endl; int pos=0; int cont=md; bool posible=true; int cont=0; for(int i=0;i<t;i++){ //cout<<w[i]<<" "<<x[pos]<<" WI XPOS"<<endl; if(pos>=a){ pq continue; } if(ws[i].first>=x[pos]){ posible=false; break; } cont--; if(cont==0){ cont=md; pos++; } } if(posible==true){ mx=md; md=(mn+mx)/2; }else{ mn=md; md=(mn+mx+1)/2; } } return mx; } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { a=A; b=B; t=T; for(int i=0;i<t;i++){ w.pb(W[i]); s.pb(S[i]); WS.pb({w[i],s[i]}); } for(int i=0;i<a;i++){ x.pb(X[i]); } for(int i=0;i<b;i++){ y.pb(Y[i]); } sort(ws.rbegin(),ws.rend()); sort(x.rbegin(),x.rend()); sort(y.rbegin(),y.rbegin()); int answer=binary(1,(t+3)/2,t+2); if(answer>t) return -1; return answer; }

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

robots.cpp: In function 'int itpass(int, std::priority_queue<std::pair<int, int> >)':
robots.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
robots.cpp: In function 'int binary(int, int, int)':
robots.cpp:30:13: error: redeclaration of 'int cont'
   30 |         int cont=0;
      |             ^~~~
robots.cpp:28:13: note: 'int cont' previously declared here
   28 |         int cont=md;
      |             ^~~~
robots.cpp:34:19: error: expected ';' before 'continue'
   34 |                 pq
      |                   ^
      |                   ;
   35 |                 continue;
      |                 ~~~~~~~~
robots.cpp:34:17: warning: statement has no effect [-Wunused-value]
   34 |                 pq
      |                 ^~
robots.cpp:37:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   37 |             if(ws[i].first>=x[pos]){
      |                  ^
robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:74:13: error: overloaded function with no contextual type information
   74 |     sort(ws.rbegin(),ws.rend());
      |             ^~~~~~
robots.cpp:74:25: error: overloaded function with no contextual type information
   74 |     sort(ws.rbegin(),ws.rend());
      |                         ^~~~