Submission #1114629

# Submission time Handle Problem Language Result Execution time Memory
1114629 2024-11-19T09:26:25 Z AdamGS Just Long Neckties (JOI20_ho_t1) C++17
9 / 100
1000 ms 8008 KB
#include <bits/stdc++.h>
#pragma gcc optimize(O3)

using namespace std;

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll n, c;
    cin >> n;

    vector<pair<ll, ll>> a;
    vector<ll> b;

    for (int i=0; i<=n; i++){
        cin >> c;
        a.push_back({c, i});
    }

    for (int i=0; i<n; i++){
        cin >> c;
        b.push_back(c);
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    ll wyn, ind_b;

    for (int us=0; us<=n; us++){
        wyn = 0;
        ind_b = n-1;
        for (int ind_a=n; ind_a>=0; ind_a--){
            if (a[ind_a].second==us) continue;
            wyn = max(wyn, max((ll)0, a[ind_a].first-b[ind_b]));
            ind_b--;
        }
        cout << wyn << " ";
    }

    return 0;
}

Compilation message

ho_t1.cpp:2: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
    2 | #pragma gcc optimize(O3)
      |
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 2 ms 464 KB Output is correct
15 Correct 3 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 4 ms 336 KB Output is correct
18 Correct 3 ms 336 KB Output is correct
19 Correct 3 ms 336 KB Output is correct
20 Correct 3 ms 336 KB Output is correct
21 Correct 4 ms 504 KB Output is correct
22 Correct 3 ms 336 KB Output is correct
23 Correct 3 ms 336 KB Output is correct
24 Correct 4 ms 336 KB Output is correct
25 Correct 4 ms 592 KB Output is correct
26 Correct 4 ms 336 KB Output is correct
27 Correct 4 ms 336 KB Output is correct
28 Correct 6 ms 336 KB Output is correct
29 Correct 3 ms 336 KB Output is correct
30 Correct 3 ms 576 KB Output is correct
31 Correct 5 ms 336 KB Output is correct
32 Correct 4 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 2 ms 464 KB Output is correct
15 Correct 3 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 4 ms 336 KB Output is correct
18 Correct 3 ms 336 KB Output is correct
19 Correct 3 ms 336 KB Output is correct
20 Correct 3 ms 336 KB Output is correct
21 Correct 4 ms 504 KB Output is correct
22 Correct 3 ms 336 KB Output is correct
23 Correct 3 ms 336 KB Output is correct
24 Correct 4 ms 336 KB Output is correct
25 Correct 4 ms 592 KB Output is correct
26 Correct 4 ms 336 KB Output is correct
27 Correct 4 ms 336 KB Output is correct
28 Correct 6 ms 336 KB Output is correct
29 Correct 3 ms 336 KB Output is correct
30 Correct 3 ms 576 KB Output is correct
31 Correct 5 ms 336 KB Output is correct
32 Correct 4 ms 336 KB Output is correct
33 Execution timed out 1049 ms 8008 KB Time limit exceeded
34 Halted 0 ms 0 KB -