답안 #871134

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871134 2023-11-10T02:08:06 Z Marco_Escandon Just Long Neckties (JOI20_ho_t1) C++11
100 / 100
185 ms 16064 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    pair<ll,ll> cad[n+1];ll cad2[n];
    for(int i=0; i<n+1; i++)
    {
        cin>>cad[i].first;
        cad[i].second=i;
    }
    for(int j=0; j<n; j++)
        cin>>cad2[j];
    sort(cad,cad+n+1);
    sort(cad2,cad2+n);
    ll ac[n+4]={ };
    for(int i=n; i>0; i--)
    {
        ac[i]=max(0LL,cad[i].first-cad2[i-1]);
        ac[i]=max(ac[i+1],ac[i]);
    }
    ll act=0;
    vector<pair<ll,ll>> sol;
    sol.push_back({cad[0].second,ac[1]});
    for(int i=0; i<n; i++)
    {
        act=max(act,cad[i].first-cad2[i]);
        sol.push_back({cad[i+1].second,max(ac[i+2],act)});
    }
    sort(sol.begin(),sol.end());
    for(auto i:sol)
        cout<<i.second<<" ";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 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 0 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 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 0 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 1 ms 348 KB Output is correct
14 Correct 1 ms 444 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 0 ms 432 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 460 KB Output is correct
23 Correct 2 ms 352 KB Output is correct
24 Correct 2 ms 352 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 3 ms 344 KB Output is correct
27 Correct 2 ms 352 KB Output is correct
28 Correct 2 ms 352 KB Output is correct
29 Correct 2 ms 352 KB Output is correct
30 Correct 2 ms 356 KB Output is correct
31 Correct 2 ms 352 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 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 0 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 1 ms 348 KB Output is correct
14 Correct 1 ms 444 KB Output is correct
15 Correct 2 ms 344 KB Output is correct
16 Correct 0 ms 432 KB Output is correct
17 Correct 2 ms 348 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 460 KB Output is correct
23 Correct 2 ms 352 KB Output is correct
24 Correct 2 ms 352 KB Output is correct
25 Correct 2 ms 604 KB Output is correct
26 Correct 3 ms 344 KB Output is correct
27 Correct 2 ms 352 KB Output is correct
28 Correct 2 ms 352 KB Output is correct
29 Correct 2 ms 352 KB Output is correct
30 Correct 2 ms 356 KB Output is correct
31 Correct 2 ms 352 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
33 Correct 165 ms 14448 KB Output is correct
34 Correct 174 ms 15300 KB Output is correct
35 Correct 185 ms 14728 KB Output is correct
36 Correct 166 ms 15296 KB Output is correct
37 Correct 171 ms 15548 KB Output is correct
38 Correct 168 ms 15552 KB Output is correct
39 Correct 170 ms 14812 KB Output is correct
40 Correct 169 ms 15548 KB Output is correct
41 Correct 184 ms 15808 KB Output is correct
42 Correct 169 ms 15040 KB Output is correct
43 Correct 167 ms 15180 KB Output is correct
44 Correct 173 ms 16064 KB Output is correct
45 Correct 161 ms 14532 KB Output is correct
46 Correct 161 ms 15868 KB Output is correct
47 Correct 161 ms 15200 KB Output is correct
48 Correct 158 ms 15948 KB Output is correct
49 Correct 174 ms 15944 KB Output is correct
50 Correct 169 ms 15712 KB Output is correct
51 Correct 168 ms 15812 KB Output is correct
52 Correct 175 ms 15836 KB Output is correct
53 Correct 172 ms 15564 KB Output is correct