Submission #212500

# Submission time Handle Problem Language Result Execution time Memory
212500 2020-03-23T09:08:40 Z DystoriaX Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

int n;
int a[200010], b[200010];
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(a + 1, a + n + 2);
    sort(b + 1, b + n + 1);

    for(int i = 1; i <= n; i++){
        ans[n + 1] = max(ans[n + 1], a[i] - b[i]);
    }

    for(int i = n; i; i--){
        ans[i] = max(ans[i + 1], a[i + 1] - b[i]);
    }

    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:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
ho_t1.cpp:12: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:13: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]);
                                 ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -