제출 #1060625

#제출 시각아이디문제언어결과실행 시간메모리
1060625vjudge1로봇 (IOI13_robots)C++17
컴파일 에러
0 ms0 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; typedef pair<int, int> ii; typedef long long ll; typedef pair<long long, long long> pll; typedef long double ld; typedef vector<int> vi; typedef vector<string> vs; #define pb push_back #define fi first #define se second #define whole(v) v.begin(), v.end() #define rwhole(v) v.rbegin(), v.rend() #define inf INT_MAX/2 #define fro front int x[], y[]; vector<ii> z; bool f(int n){ int j = 0; int i = 0; int cnt = 0; priority_queue<int> q; for(j; j < x.size(); ++j){ while(z[i].fi >= x[j]){ q.pb(z[i].se); ++i; cnt++; } if(j > 0) cnt -= n; } vector<int> ne; for(int k = 0; k < cnt; ++k){ ne.pb(q.top()); q.pop(); } sort(whole(ne)); i = 0; j = 0; for(j; j < y.size(); ++j){ int cn = 0; while(ne[i] < y[j]){ cn++; cnt--; ++i; if(cn == n){ break; } } } if(cnt > 0){ return 0; }else{ return 1; } } int putaway(int a, int b, int t, int X[], int Y[], int W[], int S[]){ x = X; y = Y; w = W; s = S; sort(x, x+a); sort(y, y+b); reverse(x, x+a); for(int i = 0; i < t; ++i){ z.pb(ii(w[i], s[i])); if(w[i] >= x[0] && s[i] >= y[0]){ return -1; } } sort(rwhole(z)); int lo = 0; int hi = t + 2; while(hi - lo > 1){ int mi = lo + (hi - lo) / 2; if(f(mi)){ hi = mi; }else{ lo = mi; } } return hi; }

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

robots.cpp:21:5: error: storage size of 'x' isn't known
   21 | int x[], y[];
      |     ^
robots.cpp:21:10: error: storage size of 'y' isn't known
   21 | int x[], y[];
      |          ^
robots.cpp: In function 'bool f(int)':
robots.cpp:29:9: warning: statement has no effect [-Wunused-value]
   29 |     for(j; j < x.size(); ++j){
      |         ^
robots.cpp:13:12: error: 'class std::priority_queue<int>' has no member named 'push_back'
   13 | #define pb push_back
      |            ^~~~~~~~~
robots.cpp:31:15: note: in expansion of macro 'pb'
   31 |             q.pb(z[i].se);
      |               ^~
robots.cpp:47:9: warning: statement has no effect [-Wunused-value]
   47 |     for(j; j < y.size(); ++j){
      |         ^
robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:66:19: error: 'w' was not declared in this scope
   66 |     x = X; y = Y; w = W; s = S;
      |                   ^
robots.cpp:66:26: error: 's' was not declared in this scope
   66 |     x = X; y = Y; w = W; s = S;
      |                          ^