Submission #436648

# Submission time Handle Problem Language Result Execution time Memory
436648 2021-06-24T17:35:10 Z Kanaifu Just Long Neckties (JOI20_ho_t1) C++14
100 / 100
299 ms 10176 KB
#include <bits/stdc++.h>

using namespace std;
#define pb push_back
#define fir first
#define sec second
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(1);
    int n;
    vector <pair<int,int>> ties;
    cin>>n;
    int pecat[n+1];
    for (int i=0; i<=n; i++)
    {
        int a;
        cin>>a;
        ties.pb({a,i});
    }
    vector <int> empl;
    for (int i=0; i<n; i++)
    {
        int a;
        cin>>a;
        empl.pb(a);
    }
    sort(ties.begin(), ties.end());
    sort(empl.begin(), empl.end());
    int weird = 0;
    for (int i=0; i<n; i++)
    {
        weird = max(weird, ties[i].fir-empl[i]);
    }
    for (int i=n; i>0; i--)
    {
        pecat[ties[i].sec] = weird;
        weird = max (weird, ties[i].fir - empl[i-1]);
    }
    pecat[ties[0].sec] = weird;
    for (int i=0; i<=n; i++)
    {
        cout<<pecat[i]<<" ";
    }
}


# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 3 ms 332 KB Output is correct
18 Correct 3 ms 460 KB Output is correct
19 Correct 3 ms 332 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
21 Correct 4 ms 332 KB Output is correct
22 Correct 3 ms 332 KB Output is correct
23 Correct 4 ms 332 KB Output is correct
24 Correct 3 ms 332 KB Output is correct
25 Correct 3 ms 332 KB Output is correct
26 Correct 3 ms 332 KB Output is correct
27 Correct 3 ms 332 KB Output is correct
28 Correct 3 ms 304 KB Output is correct
29 Correct 3 ms 348 KB Output is correct
30 Correct 2 ms 332 KB Output is correct
31 Correct 3 ms 300 KB Output is correct
32 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 3 ms 332 KB Output is correct
18 Correct 3 ms 460 KB Output is correct
19 Correct 3 ms 332 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
21 Correct 4 ms 332 KB Output is correct
22 Correct 3 ms 332 KB Output is correct
23 Correct 4 ms 332 KB Output is correct
24 Correct 3 ms 332 KB Output is correct
25 Correct 3 ms 332 KB Output is correct
26 Correct 3 ms 332 KB Output is correct
27 Correct 3 ms 332 KB Output is correct
28 Correct 3 ms 304 KB Output is correct
29 Correct 3 ms 348 KB Output is correct
30 Correct 2 ms 332 KB Output is correct
31 Correct 3 ms 300 KB Output is correct
32 Correct 3 ms 332 KB Output is correct
33 Correct 230 ms 9480 KB Output is correct
34 Correct 251 ms 9876 KB Output is correct
35 Correct 234 ms 9548 KB Output is correct
36 Correct 276 ms 9964 KB Output is correct
37 Correct 242 ms 10176 KB Output is correct
38 Correct 264 ms 10092 KB Output is correct
39 Correct 235 ms 9228 KB Output is correct
40 Correct 240 ms 9172 KB Output is correct
41 Correct 238 ms 9260 KB Output is correct
42 Correct 242 ms 9268 KB Output is correct
43 Correct 276 ms 9112 KB Output is correct
44 Correct 239 ms 8736 KB Output is correct
45 Correct 232 ms 8908 KB Output is correct
46 Correct 228 ms 8752 KB Output is correct
47 Correct 299 ms 8848 KB Output is correct
48 Correct 232 ms 8852 KB Output is correct
49 Correct 284 ms 9524 KB Output is correct
50 Correct 243 ms 9460 KB Output is correct
51 Correct 246 ms 9448 KB Output is correct
52 Correct 255 ms 9480 KB Output is correct
53 Correct 265 ms 9476 KB Output is correct