답안 #212502

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
212502 2020-03-23T09:38:34 Z DystoriaX Just Long Neckties (JOI20_ho_t1) C++14
9 / 100
1000 ms 6640 KB
#include <bits/stdc++.h>

using namespace std;

int n;
int a[200010], b[200010];
vector<int> c;
int ans[200010];

int main(){
    scanf("%d", &n);

    for(int i = 1; i <= n + 1; i++) scanf("%d", &a[i]);
    for(int i = 1; i <= n; i++) scanf("%d", &b[i]);

    sort(b + 1, b + n + 1);

    for(int i = 1; i <= n + 1; i++){
        c.clear();
        for(int j = 1; j <= n + 1; j++){
            if(i == j) continue;
            c.emplace_back(a[j]);
        }

        sort(c.begin(), c.end());

        for(int j = 0; j < (int) c.size(); j++){
            ans[i] = max(ans[i], c[j] - b[j + 1]);
        }
    }

    for(int i = 1; i <= n + 1; i++){
        printf("%d ", ans[i]);
    }
    
    printf("\n");

    return 0;
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
ho_t1.cpp:13:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n + 1; i++) scanf("%d", &a[i]);
                                     ~~~~~^~~~~~~~~~~~~
ho_t1.cpp:14:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; i++) scanf("%d", &b[i]);
                                 ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 35 ms 384 KB Output is correct
15 Correct 95 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 169 ms 444 KB Output is correct
18 Correct 116 ms 476 KB Output is correct
19 Correct 130 ms 480 KB Output is correct
20 Correct 122 ms 384 KB Output is correct
21 Correct 126 ms 384 KB Output is correct
22 Correct 131 ms 384 KB Output is correct
23 Correct 120 ms 480 KB Output is correct
24 Correct 125 ms 384 KB Output is correct
25 Correct 184 ms 384 KB Output is correct
26 Correct 161 ms 384 KB Output is correct
27 Correct 163 ms 508 KB Output is correct
28 Correct 176 ms 384 KB Output is correct
29 Correct 126 ms 384 KB Output is correct
30 Correct 161 ms 384 KB Output is correct
31 Correct 180 ms 384 KB Output is correct
32 Correct 201 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 35 ms 384 KB Output is correct
15 Correct 95 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 169 ms 444 KB Output is correct
18 Correct 116 ms 476 KB Output is correct
19 Correct 130 ms 480 KB Output is correct
20 Correct 122 ms 384 KB Output is correct
21 Correct 126 ms 384 KB Output is correct
22 Correct 131 ms 384 KB Output is correct
23 Correct 120 ms 480 KB Output is correct
24 Correct 125 ms 384 KB Output is correct
25 Correct 184 ms 384 KB Output is correct
26 Correct 161 ms 384 KB Output is correct
27 Correct 163 ms 508 KB Output is correct
28 Correct 176 ms 384 KB Output is correct
29 Correct 126 ms 384 KB Output is correct
30 Correct 161 ms 384 KB Output is correct
31 Correct 180 ms 384 KB Output is correct
32 Correct 201 ms 384 KB Output is correct
33 Execution timed out 1082 ms 6640 KB Time limit exceeded
34 Halted 0 ms 0 KB -