# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
365176 | 2021-02-11T06:26:53 Z | jazzup | Just Long Neckties (JOI20_ho_t1) | C++17 | 1000 ms | 6444 KB |
#include<cstdio> #include<algorithm> using namespace std; int a[200010],aa[200010],b[200010]; int main(){ int n; scanf("%d",&n); for(int i=0;i<=n;i++){ scanf("%d",&aa[i]); a[i]=aa[i]; } sort(a,a+n+1); for(int i=0;i<n;i++){ scanf("%d",&b[i]); } sort(b,b+n); for(int i=0;i<=n;i++){ int ans=0; int p=aa[i]; bool d=false; for(int j=0;j<=n;j++){ if(!d){ if(a[j]==p){ d=true; continue; } ans=max(ans,max(a[j]-b[j],0)); } else ans=max(ans,max(a[j]-b[j-1],0)); } printf("%d ",ans); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Correct | 0 ms | 364 KB | Output is correct |
12 | Correct | 0 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Correct | 0 ms | 364 KB | Output is correct |
12 | Correct | 0 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 2 ms | 364 KB | Output is correct |
15 | Correct | 4 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 5 ms | 364 KB | Output is correct |
18 | Correct | 4 ms | 364 KB | Output is correct |
19 | Correct | 4 ms | 364 KB | Output is correct |
20 | Correct | 5 ms | 364 KB | Output is correct |
21 | Correct | 4 ms | 384 KB | Output is correct |
22 | Correct | 4 ms | 492 KB | Output is correct |
23 | Correct | 4 ms | 364 KB | Output is correct |
24 | Correct | 4 ms | 364 KB | Output is correct |
25 | Correct | 6 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 364 KB | Output is correct |
27 | Correct | 7 ms | 364 KB | Output is correct |
28 | Correct | 6 ms | 384 KB | Output is correct |
29 | Correct | 4 ms | 364 KB | Output is correct |
30 | Correct | 5 ms | 364 KB | Output is correct |
31 | Correct | 6 ms | 364 KB | Output is correct |
32 | Correct | 6 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Correct | 0 ms | 364 KB | Output is correct |
12 | Correct | 0 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 2 ms | 364 KB | Output is correct |
15 | Correct | 4 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 5 ms | 364 KB | Output is correct |
18 | Correct | 4 ms | 364 KB | Output is correct |
19 | Correct | 4 ms | 364 KB | Output is correct |
20 | Correct | 5 ms | 364 KB | Output is correct |
21 | Correct | 4 ms | 384 KB | Output is correct |
22 | Correct | 4 ms | 492 KB | Output is correct |
23 | Correct | 4 ms | 364 KB | Output is correct |
24 | Correct | 4 ms | 364 KB | Output is correct |
25 | Correct | 6 ms | 376 KB | Output is correct |
26 | Correct | 5 ms | 364 KB | Output is correct |
27 | Correct | 7 ms | 364 KB | Output is correct |
28 | Correct | 6 ms | 384 KB | Output is correct |
29 | Correct | 4 ms | 364 KB | Output is correct |
30 | Correct | 5 ms | 364 KB | Output is correct |
31 | Correct | 6 ms | 364 KB | Output is correct |
32 | Correct | 6 ms | 364 KB | Output is correct |
33 | Execution timed out | 1085 ms | 6444 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |