이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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)
typedef long long ll;
#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;
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
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];
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |