제출 #1243901

#제출 시각아이디문제언어결과실행 시간메모리
1243901AmaarsaaRobots (IOI13_robots)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "robots.h" using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort ( X, X + A); sort ( Y, Y + B);` vector < int > only_A, only_B, Both; for (i = 0; i < T; i ++) { if ( W[i] > X.back()) only_B.push_back(S[i]); if ( S[i] > Y.back()) only_A.push_back(W[i]); if ( W[i] > X.back() && S[i] > Y.back()) return -1; if( W[i] <= X.back() && S[i] <= Y.back()) { Both.push_back(i); } } lo = 0; hi = 1e9; while ( lo < hi) { mid = (lo + hi)/2; r = 0; for (i = 0; i < X.size(); i ++) { cnt = mid; while ( cnt -- && r < only_A.size()) { if ( only_A[r] <= X[i]) r ++; else break; } } if ( r < only_A.size()){ lo = mid + 1; continue; } r = 0; for (i = 0; i < Y.size(); i ++) { cnt = mid; while ( cnt -- && r < only_B.size()) { if ( only_B[r] <= Y[i]) r ++; else break; } } if ( r < only_B.size()){ lo = mid + 1; continue; } } return 42; }

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

robots.cpp:9:22: error: stray '`' in program
    9 |     sort ( Y, Y + B);`
      |                      ^
robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:13:10: error: 'i' was not declared in this scope
   13 |     for (i = 0; i < T; i ++) {
      |          ^
robots.cpp:14:23: error: request for member 'back' in 'X', which is of non-class type 'int*'
   14 |         if ( W[i] > X.back()) only_B.push_back(S[i]);
      |                       ^~~~
robots.cpp:15:23: error: request for member 'back' in 'Y', which is of non-class type 'int*'
   15 |         if ( S[i] > Y.back()) only_A.push_back(W[i]);
      |                       ^~~~
robots.cpp:16:23: error: request for member 'back' in 'X', which is of non-class type 'int*'
   16 |         if ( W[i] > X.back() && S[i] > Y.back()) return -1;
      |                       ^~~~
robots.cpp:16:42: error: request for member 'back' in 'Y', which is of non-class type 'int*'
   16 |         if ( W[i] > X.back() && S[i] > Y.back()) return -1;
      |                                          ^~~~
robots.cpp:17:23: error: request for member 'back' in 'X', which is of non-class type 'int*'
   17 |         if( W[i] <= X.back() && S[i] <= Y.back()) {
      |                       ^~~~
robots.cpp:17:43: error: request for member 'back' in 'Y', which is of non-class type 'int*'
   17 |         if( W[i] <= X.back() && S[i] <= Y.back()) {
      |                                           ^~~~
robots.cpp:22:5: error: 'lo' was not declared in this scope; did you mean 'log'?
   22 |     lo = 0;
      |     ^~
      |     log
robots.cpp:23:5: error: 'hi' was not declared in this scope
   23 |     hi = 1e9;
      |     ^~
robots.cpp:26:9: error: 'mid' was not declared in this scope
   26 |         mid = (lo + hi)/2;
      |         ^~~
robots.cpp:27:9: error: 'r' was not declared in this scope
   27 |         r = 0;
      |         ^
robots.cpp:28:14: error: 'i' was not declared in this scope
   28 |         for (i = 0; i < X.size(); i ++) {
      |              ^
robots.cpp:28:27: error: request for member 'size' in 'X', which is of non-class type 'int*'
   28 |         for (i = 0; i < X.size(); i ++) {
      |                           ^~~~
robots.cpp:29:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   29 |             cnt = mid;
      |             ^~~
      |             int
robots.cpp:40:14: error: 'i' was not declared in this scope
   40 |         for (i = 0; i < Y.size(); i ++) {
      |              ^
robots.cpp:40:27: error: request for member 'size' in 'Y', which is of non-class type 'int*'
   40 |         for (i = 0; i < Y.size(); i ++) {
      |                           ^~~~
robots.cpp:41:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   41 |             cnt = mid;
      |             ^~~
      |             int