Submission #953513

# Submission time Handle Problem Language Result Execution time Memory
953513 2024-03-26T05:04:14 Z irmuun Just Long Neckties (JOI20_ho_t1) C++17
9 / 100
1000 ms 11372 KB
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    ll b[n+5];
    pair<ll,ll>a[n+5];
    ll ans[n+5];
    for(ll i=1;i<=n+1;i++){
        cin>>a[i].ff;
        a[i].ss=i;
    }
    for(ll i=1;i<=n;i++){
        cin>>b[i];
    }
    sort(a+1,a+n+2);
    sort(b+1,b+n+1);
    ll c[n+5];
    for(ll i=1;i<=n+1;i++){
        ll cur=0;
        for(ll j=1;j<=n+1;j++){
            if(j!=i){
                c[++cur]=a[j].ff;
            }
        }
        ll res=0;
        for(ll j=1;j<=n;j++){
            res=max(res,c[j]-b[j]);
        }
        ans[a[i].ss]=res;
    }
    for(ll i=1;i<=n+1;i++){
        cout<<ans[i]<<' ';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 456 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 456 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 456 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 456 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 6 ms 348 KB Output is correct
18 Correct 5 ms 344 KB Output is correct
19 Correct 6 ms 348 KB Output is correct
20 Correct 5 ms 348 KB Output is correct
21 Correct 5 ms 348 KB Output is correct
22 Correct 5 ms 348 KB Output is correct
23 Correct 5 ms 348 KB Output is correct
24 Correct 5 ms 544 KB Output is correct
25 Correct 7 ms 348 KB Output is correct
26 Correct 6 ms 348 KB Output is correct
27 Correct 6 ms 548 KB Output is correct
28 Correct 7 ms 552 KB Output is correct
29 Correct 5 ms 348 KB Output is correct
30 Correct 6 ms 548 KB Output is correct
31 Correct 7 ms 348 KB Output is correct
32 Correct 7 ms 560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 456 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 456 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 4 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 6 ms 348 KB Output is correct
18 Correct 5 ms 344 KB Output is correct
19 Correct 6 ms 348 KB Output is correct
20 Correct 5 ms 348 KB Output is correct
21 Correct 5 ms 348 KB Output is correct
22 Correct 5 ms 348 KB Output is correct
23 Correct 5 ms 348 KB Output is correct
24 Correct 5 ms 544 KB Output is correct
25 Correct 7 ms 348 KB Output is correct
26 Correct 6 ms 348 KB Output is correct
27 Correct 6 ms 548 KB Output is correct
28 Correct 7 ms 552 KB Output is correct
29 Correct 5 ms 348 KB Output is correct
30 Correct 6 ms 548 KB Output is correct
31 Correct 7 ms 348 KB Output is correct
32 Correct 7 ms 560 KB Output is correct
33 Execution timed out 1055 ms 11372 KB Time limit exceeded
34 Halted 0 ms 0 KB -