제출 #657436

#제출 시각아이디문제언어결과실행 시간메모리
657436PanTkd로봇 (IOI13_robots)C++14
컴파일 에러
0 ms0 KiB
#include <stdio.h> #include <stdlib.h> #include "robots.h" #include <iostream> using namespace std; #define fail(s, x...) do { \ fprintf(stderr, s "\n", ## x); \ exit(1); \ } while(0) #define MAX_A 50000 #define MAX_B 50000 #define MAX_T 500000 static int X[MAX_A]; static int Y[MAX_B]; static int W[MAX_T]; static int S[MAX_T]; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { ll ans=-1; if(A==2){ ll x1=max(X[0],X[1]),x2=min(X[0],X[1]); ll w1=max(W[0],W[1]),w2=min(W[0],W[1]); if(x1>w1&&x2>w2) ans=1; else if(x1>w1) ans = 2; } else if(A==1&&B==1){ for(ll i = 0 ;i<2;i++){ if(X[0]>W[i%2] && X[0]>W[(i+1)%2])ans=2; else if(Y[0]>S[i%2] && Y[0]>S[(i+1)%2])ans=2; } for(ll i = 0 ;i<2;i++){ if(X[0]>W[i%2] && Y[0]>S[(i+1)%2])ans=1; } } else{ ll y1=max(Y[0],Y[1]),y2=min(Y[0],Y[1]); ll s1=max(S[0],S[1]),s2=min(S[0],S[1]); if(y1>s1&&y2>s2) ans=1; else if(y1>s1) ans = 2; } cout<<ans<<endl; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:22:5: error: 'll' was not declared in this scope
   22 |     ll ans=-1;
      |     ^~
robots.cpp:24:11: error: expected ';' before 'x1'
   24 |         ll x1=max(X[0],X[1]),x2=min(X[0],X[1]);
      |           ^~~
      |           ;
robots.cpp:25:11: error: expected ';' before 'w1'
   25 |         ll w1=max(W[0],W[1]),w2=min(W[0],W[1]);
      |           ^~~
      |           ;
robots.cpp:26:12: error: 'x1' was not declared in this scope
   26 |         if(x1>w1&&x2>w2) ans=1;
      |            ^~
robots.cpp:26:15: error: 'w1' was not declared in this scope
   26 |         if(x1>w1&&x2>w2) ans=1;
      |               ^~
robots.cpp:26:19: error: 'x2' was not declared in this scope
   26 |         if(x1>w1&&x2>w2) ans=1;
      |                   ^~
robots.cpp:26:22: error: 'w2' was not declared in this scope
   26 |         if(x1>w1&&x2>w2) ans=1;
      |                      ^~
robots.cpp:26:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |         if(x1>w1&&x2>w2) ans=1;
      |                          ^~~
      |                          abs
robots.cpp:27:24: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |         else if(x1>w1) ans = 2;
      |                        ^~~
      |                        abs
robots.cpp:30:15: error: expected ';' before 'i'
   30 |         for(ll i = 0 ;i<2;i++){
      |               ^~
      |               ;
robots.cpp:30:23: error: 'i' was not declared in this scope
   30 |         for(ll i = 0 ;i<2;i++){
      |                       ^
robots.cpp:31:47: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |             if(X[0]>W[i%2] && X[0]>W[(i+1)%2])ans=2;
      |                                               ^~~
      |                                               abs
robots.cpp:32:52: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |             else if(Y[0]>S[i%2] && Y[0]>S[(i+1)%2])ans=2;
      |                                                    ^~~
      |                                                    abs
robots.cpp:34:15: error: expected ';' before 'i'
   34 |         for(ll i = 0 ;i<2;i++){
      |               ^~
      |               ;
robots.cpp:34:23: error: 'i' was not declared in this scope
   34 |         for(ll i = 0 ;i<2;i++){
      |                       ^
robots.cpp:35:47: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |             if(X[0]>W[i%2] && Y[0]>S[(i+1)%2])ans=1;
      |                                               ^~~
      |                                               abs
robots.cpp:39:11: error: expected ';' before 'y1'
   39 |         ll y1=max(Y[0],Y[1]),y2=min(Y[0],Y[1]);
      |           ^~~
      |           ;
robots.cpp:40:11: error: expected ';' before 's1'
   40 |         ll s1=max(S[0],S[1]),s2=min(S[0],S[1]);
      |           ^~~
      |           ;
robots.cpp:41:12: error: 'y1' was not declared in this scope
   41 |         if(y1>s1&&y2>s2) ans=1;
      |            ^~
robots.cpp:41:15: error: 's1' was not declared in this scope
   41 |         if(y1>s1&&y2>s2) ans=1;
      |               ^~
robots.cpp:41:19: error: 'y2' was not declared in this scope
   41 |         if(y1>s1&&y2>s2) ans=1;
      |                   ^~
robots.cpp:41:22: error: 's2' was not declared in this scope
   41 |         if(y1>s1&&y2>s2) ans=1;
      |                      ^~
robots.cpp:41:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
   41 |         if(y1>s1&&y2>s2) ans=1;
      |                          ^~~
      |                          abs
robots.cpp:42:24: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |         else if(y1>s1) ans = 2;
      |                        ^~~
      |                        abs
robots.cpp:44:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |     cout<<ans<<endl;
      |           ^~~
      |           abs
robots.cpp:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
robots.cpp: At global scope:
robots.cpp:18:12: warning: 'S' defined but not used [-Wunused-variable]
   18 | static int S[MAX_T];
      |            ^
robots.cpp:17:12: warning: 'W' defined but not used [-Wunused-variable]
   17 | static int W[MAX_T];
      |            ^
robots.cpp:16:12: warning: 'Y' defined but not used [-Wunused-variable]
   16 | static int Y[MAX_B];
      |            ^
robots.cpp:15:12: warning: 'X' defined but not used [-Wunused-variable]
   15 | static int X[MAX_A];
      |            ^