Submission #762899

# Submission time Handle Problem Language Result Execution time Memory
762899 2023-06-22T01:07:43 Z adaawf Just Long Neckties (JOI20_ho_t1) C++14
100 / 100
184 ms 6988 KB
#include <iostream>
#include <algorithm>
using namespace std;
pair<int, int> a[200005];
int b[200005], c[200005], f[200005], res[200005];
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n + 1; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }
    for (int i = 1; i <= n; i++) {
        cin >> b[i];
    }
    sort(a + 1, a + n + 2);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; i++) {
        c[i] = max(c[i - 1], a[i].first - b[i]);
        //cout << c[i] << " ";
    }
    for (int i = n + 1; i >= 2; i--) {
        f[i] = max(f[i + 1], a[i].first - b[i - 1]);
    }
    for (int i = 1; i <= n + 1; i++) {
        res[a[i].second] = max(c[i - 1], f[i + 1]);
    }
    for (int i = 1; i <= n + 1; i++) cout << res[i] << " ";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 2 ms 340 KB Output is correct
28 Correct 2 ms 320 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 5 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 2 ms 340 KB Output is correct
28 Correct 2 ms 320 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 5 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 2 ms 340 KB Output is correct
33 Correct 138 ms 6232 KB Output is correct
34 Correct 143 ms 6472 KB Output is correct
35 Correct 143 ms 6256 KB Output is correct
36 Correct 144 ms 6696 KB Output is correct
37 Correct 150 ms 6988 KB Output is correct
38 Correct 147 ms 6804 KB Output is correct
39 Correct 141 ms 5936 KB Output is correct
40 Correct 142 ms 5916 KB Output is correct
41 Correct 140 ms 5972 KB Output is correct
42 Correct 144 ms 5904 KB Output is correct
43 Correct 156 ms 5896 KB Output is correct
44 Correct 141 ms 5740 KB Output is correct
45 Correct 143 ms 5612 KB Output is correct
46 Correct 157 ms 5600 KB Output is correct
47 Correct 138 ms 5420 KB Output is correct
48 Correct 140 ms 5452 KB Output is correct
49 Correct 161 ms 6036 KB Output is correct
50 Correct 145 ms 6048 KB Output is correct
51 Correct 152 ms 6132 KB Output is correct
52 Correct 184 ms 6048 KB Output is correct
53 Correct 145 ms 6084 KB Output is correct