이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <stdlib.h>
#include "robots.h"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#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;
ll i = 0 , j = 0 ;
sort(X,X+A);
sort(W,W+T);
reverse(X,X+A);
reverse(W,W+T);
if(X[0]<=W[0]) return -1;
vector<ll> v(T,0);
ll posa=0;
while(posa<T){
if(i == A){
i = 0;
ans++;
}
else if(j==T)
j=0;
else if (v[j])
j++;
else if(X[i]>W[j]){
i++,j++;
v[j]=1;
posa++;
}
else{
j++;
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
robots.cpp:22:12: warning: 'S' defined but not used [-Wunused-variable]
22 | static int S[MAX_T];
| ^
robots.cpp:21:12: warning: 'W' defined but not used [-Wunused-variable]
21 | static int W[MAX_T];
| ^
robots.cpp:20:12: warning: 'Y' defined but not used [-Wunused-variable]
20 | static int Y[MAX_B];
| ^
robots.cpp:19:12: warning: 'X' defined but not used [-Wunused-variable]
19 | 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... |