Submission #732310

# Submission time Handle Problem Language Result Execution time Memory
732310 2023-04-29T01:17:57 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
9 / 100
1000 ms 9120 KB
#include <bits/stdc++.h>
#define B begin()
#define E end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define sts stable_sort
using namespace std;

const int MAXN = 1e6 + 4;
const int MOD = 1e9 + 7;

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

    int n; cin >> n;
    vector<ll> v(n + 1);
    vector<ll> asd(n + 1);
    vector<ll> b(n);

    for(int i = 0; i <= n; i++){
        cin >> v[i];
        asd[i] = v[i];
    }
    sts(v.B, v.E);

    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    sts(b.B, b.E);
    map<ll, ll> m;

    ll maxant = 0;
    for(int i = 0; i <= n; i++){
        ll maxi = 0, pos = i + 1;
        if(i < n){
            maxant = max(maxant, v[i] - b[i]);
            maxi = max(maxi, v[pos] - b[i]);
            if(pos < n){
                for(int j = i + 2; j <= n; j++){
                    ll x = v[j] - b[pos];
                    maxi = max(maxi, x);
                    pos++;
                }
            }
        }
        m[v[i]] = max(maxi, maxant);
    }

    for(int i = 0; i <= n; i++){
        cout << m[asd[i]] << " ";
    }cout << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 3 ms 468 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 3 ms 460 KB Output is correct
21 Correct 3 ms 460 KB Output is correct
22 Correct 3 ms 468 KB Output is correct
23 Correct 3 ms 468 KB Output is correct
24 Correct 4 ms 468 KB Output is correct
25 Correct 3 ms 468 KB Output is correct
26 Correct 3 ms 468 KB Output is correct
27 Correct 3 ms 468 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 3 ms 468 KB Output is correct
30 Correct 4 ms 584 KB Output is correct
31 Correct 4 ms 468 KB Output is correct
32 Correct 4 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 3 ms 468 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 3 ms 468 KB Output is correct
18 Correct 3 ms 468 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 3 ms 460 KB Output is correct
21 Correct 3 ms 460 KB Output is correct
22 Correct 3 ms 468 KB Output is correct
23 Correct 3 ms 468 KB Output is correct
24 Correct 4 ms 468 KB Output is correct
25 Correct 3 ms 468 KB Output is correct
26 Correct 3 ms 468 KB Output is correct
27 Correct 3 ms 468 KB Output is correct
28 Correct 3 ms 468 KB Output is correct
29 Correct 3 ms 468 KB Output is correct
30 Correct 4 ms 584 KB Output is correct
31 Correct 4 ms 468 KB Output is correct
32 Correct 4 ms 468 KB Output is correct
33 Execution timed out 1064 ms 9120 KB Time limit exceeded
34 Halted 0 ms 0 KB -