Submission #836686

# Submission time Handle Problem Language Result Execution time Memory
836686 2023-08-24T14:01:56 Z 12345678 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
0 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=2e5+5;
int n, a[nx], b[nx], l[nx], r[nx], mx;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n+1; i++) cin>>a[i];
    for (int i=1; i<=n; i++) cin>>b[i]; b[n+1]=1e9;
    sort(b+1, b+n+1);
    sort(a+1, a+n+2);
    for (int i=1; i<=n+1; i++) l[i]=max(l[i-1], a[i]-b[i]);
    for (int i=n; i>=1; i--) r[i]=max(r[i+1], a[i+1]-b[i]);
    for (int i=1; i<=n+1; i++) cout<<max(l[i], r[i])<<' ';
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:13:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   13 |     for (int i=1; i<=n; i++) cin>>b[i]; b[n+1]=1e9;
      |     ^~~
ho_t1.cpp:13:41: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   13 |     for (int i=1; i<=n; i++) cin>>b[i]; b[n+1]=1e9;
      |                                         ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -