답안 #634527

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634527 2022-08-24T14:23:24 Z Darren0724 Team Contest (JOI22_team) C++17
27 / 100
610 ms 8124 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define rz resize
#define pb emplace_back
int INF=1e18;
int mod=1e9+7;
int N=4010;

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  vector<int> a(n),b(n),c(n);
  vector<vector<pii>> v(N+1);
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i]>>c[i];
    assert(a[i]<=4000);
    assert(b[i]<=4000);
    assert(c[i]<=4000);
    v[a[i]].push_back({b[i],c[i]});
  }
  vector<int> rec(N+2),rec1(N+2);
  int ans=-1;
  for(int i=1;i<=N;i++){
    for(auto p:v[i]){
      for(int j=p.first+1;j<=N;j++){
        if(rec1[j]>p.second)ans=max(ans,i+j+rec1[j]);
      }
    }
    for(auto p:v[i]){
      rec[p.first+1]=max(rec[p.first+1],p.second);
    }
    for(int j=2;j<=N;j++){
      rec[j]=max(rec[j],rec[j-1]);
    }
    for(auto p:v[i]){
      if(rec[p.first]>p.second){
        rec1[p.first]=max(rec[p.first],rec1[p.first]);
      }
    }
    for(int j=N-1;j>=0;j--){
      rec1[j]=max(rec1[j],rec1[j+1]);
    }
    /*for(int j=1;j<=N;j++){
      cout<<rec[j]<<' ';
    }
    cout<<endl;
    for(int j=1;j<=N;j++){
      cout<<rec1[j]<<' ';
    }
    cout<<endl;*/
  }
  cout<<ans<<endl;

  return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 460 KB Output is correct
2 Correct 106 ms 468 KB Output is correct
3 Correct 106 ms 468 KB Output is correct
4 Correct 107 ms 468 KB Output is correct
5 Correct 106 ms 468 KB Output is correct
6 Correct 105 ms 448 KB Output is correct
7 Correct 107 ms 468 KB Output is correct
8 Correct 110 ms 448 KB Output is correct
9 Correct 105 ms 468 KB Output is correct
10 Correct 104 ms 468 KB Output is correct
11 Correct 106 ms 468 KB Output is correct
12 Correct 104 ms 340 KB Output is correct
13 Correct 106 ms 468 KB Output is correct
14 Runtime error 1 ms 596 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 460 KB Output is correct
2 Correct 106 ms 468 KB Output is correct
3 Correct 106 ms 468 KB Output is correct
4 Correct 107 ms 468 KB Output is correct
5 Correct 106 ms 468 KB Output is correct
6 Correct 105 ms 448 KB Output is correct
7 Correct 107 ms 468 KB Output is correct
8 Correct 110 ms 448 KB Output is correct
9 Correct 105 ms 468 KB Output is correct
10 Correct 104 ms 468 KB Output is correct
11 Correct 106 ms 468 KB Output is correct
12 Correct 104 ms 340 KB Output is correct
13 Correct 106 ms 468 KB Output is correct
14 Runtime error 1 ms 596 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 468 KB Output is correct
2 Correct 108 ms 468 KB Output is correct
3 Correct 109 ms 468 KB Output is correct
4 Correct 106 ms 460 KB Output is correct
5 Correct 108 ms 468 KB Output is correct
6 Correct 110 ms 468 KB Output is correct
7 Correct 111 ms 468 KB Output is correct
8 Correct 109 ms 452 KB Output is correct
9 Correct 107 ms 468 KB Output is correct
10 Correct 109 ms 468 KB Output is correct
11 Correct 527 ms 6440 KB Output is correct
12 Correct 411 ms 4828 KB Output is correct
13 Correct 458 ms 5476 KB Output is correct
14 Correct 535 ms 7456 KB Output is correct
15 Correct 560 ms 7308 KB Output is correct
16 Correct 525 ms 8124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 468 KB Output is correct
2 Correct 108 ms 468 KB Output is correct
3 Correct 109 ms 468 KB Output is correct
4 Correct 106 ms 460 KB Output is correct
5 Correct 108 ms 468 KB Output is correct
6 Correct 110 ms 468 KB Output is correct
7 Correct 111 ms 468 KB Output is correct
8 Correct 109 ms 452 KB Output is correct
9 Correct 107 ms 468 KB Output is correct
10 Correct 109 ms 468 KB Output is correct
11 Correct 527 ms 6440 KB Output is correct
12 Correct 411 ms 4828 KB Output is correct
13 Correct 458 ms 5476 KB Output is correct
14 Correct 535 ms 7456 KB Output is correct
15 Correct 560 ms 7308 KB Output is correct
16 Correct 525 ms 8124 KB Output is correct
17 Correct 108 ms 468 KB Output is correct
18 Correct 111 ms 448 KB Output is correct
19 Correct 107 ms 468 KB Output is correct
20 Correct 107 ms 472 KB Output is correct
21 Correct 111 ms 576 KB Output is correct
22 Correct 610 ms 6860 KB Output is correct
23 Correct 521 ms 6496 KB Output is correct
24 Correct 414 ms 5204 KB Output is correct
25 Correct 558 ms 7168 KB Output is correct
26 Correct 524 ms 6540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 468 KB Output is correct
2 Correct 108 ms 468 KB Output is correct
3 Correct 109 ms 468 KB Output is correct
4 Correct 106 ms 460 KB Output is correct
5 Correct 108 ms 468 KB Output is correct
6 Correct 110 ms 468 KB Output is correct
7 Correct 111 ms 468 KB Output is correct
8 Correct 109 ms 452 KB Output is correct
9 Correct 107 ms 468 KB Output is correct
10 Correct 109 ms 468 KB Output is correct
11 Correct 527 ms 6440 KB Output is correct
12 Correct 411 ms 4828 KB Output is correct
13 Correct 458 ms 5476 KB Output is correct
14 Correct 535 ms 7456 KB Output is correct
15 Correct 560 ms 7308 KB Output is correct
16 Correct 525 ms 8124 KB Output is correct
17 Correct 108 ms 468 KB Output is correct
18 Correct 111 ms 448 KB Output is correct
19 Correct 107 ms 468 KB Output is correct
20 Correct 107 ms 472 KB Output is correct
21 Correct 111 ms 576 KB Output is correct
22 Correct 610 ms 6860 KB Output is correct
23 Correct 521 ms 6496 KB Output is correct
24 Correct 414 ms 5204 KB Output is correct
25 Correct 558 ms 7168 KB Output is correct
26 Correct 524 ms 6540 KB Output is correct
27 Correct 110 ms 472 KB Output is correct
28 Correct 108 ms 468 KB Output is correct
29 Correct 107 ms 468 KB Output is correct
30 Correct 109 ms 488 KB Output is correct
31 Correct 123 ms 644 KB Output is correct
32 Correct 110 ms 504 KB Output is correct
33 Correct 108 ms 468 KB Output is correct
34 Correct 538 ms 6736 KB Output is correct
35 Correct 476 ms 7324 KB Output is correct
36 Correct 529 ms 7588 KB Output is correct
37 Correct 506 ms 7372 KB Output is correct
38 Correct 517 ms 6708 KB Output is correct
39 Correct 360 ms 4680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 107 ms 468 KB Output is correct
2 Correct 108 ms 468 KB Output is correct
3 Correct 109 ms 468 KB Output is correct
4 Correct 106 ms 460 KB Output is correct
5 Correct 108 ms 468 KB Output is correct
6 Correct 110 ms 468 KB Output is correct
7 Correct 111 ms 468 KB Output is correct
8 Correct 109 ms 452 KB Output is correct
9 Correct 107 ms 468 KB Output is correct
10 Correct 109 ms 468 KB Output is correct
11 Correct 527 ms 6440 KB Output is correct
12 Correct 411 ms 4828 KB Output is correct
13 Correct 458 ms 5476 KB Output is correct
14 Correct 535 ms 7456 KB Output is correct
15 Correct 560 ms 7308 KB Output is correct
16 Correct 525 ms 8124 KB Output is correct
17 Correct 108 ms 468 KB Output is correct
18 Correct 111 ms 448 KB Output is correct
19 Correct 107 ms 468 KB Output is correct
20 Correct 107 ms 472 KB Output is correct
21 Correct 111 ms 576 KB Output is correct
22 Correct 610 ms 6860 KB Output is correct
23 Correct 521 ms 6496 KB Output is correct
24 Correct 414 ms 5204 KB Output is correct
25 Correct 558 ms 7168 KB Output is correct
26 Correct 524 ms 6540 KB Output is correct
27 Correct 110 ms 472 KB Output is correct
28 Correct 108 ms 468 KB Output is correct
29 Correct 107 ms 468 KB Output is correct
30 Correct 109 ms 488 KB Output is correct
31 Correct 123 ms 644 KB Output is correct
32 Correct 110 ms 504 KB Output is correct
33 Correct 108 ms 468 KB Output is correct
34 Correct 538 ms 6736 KB Output is correct
35 Correct 476 ms 7324 KB Output is correct
36 Correct 529 ms 7588 KB Output is correct
37 Correct 506 ms 7372 KB Output is correct
38 Correct 517 ms 6708 KB Output is correct
39 Correct 360 ms 4680 KB Output is correct
40 Incorrect 110 ms 596 KB Output isn't correct
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 460 KB Output is correct
2 Correct 106 ms 468 KB Output is correct
3 Correct 106 ms 468 KB Output is correct
4 Correct 107 ms 468 KB Output is correct
5 Correct 106 ms 468 KB Output is correct
6 Correct 105 ms 448 KB Output is correct
7 Correct 107 ms 468 KB Output is correct
8 Correct 110 ms 448 KB Output is correct
9 Correct 105 ms 468 KB Output is correct
10 Correct 104 ms 468 KB Output is correct
11 Correct 106 ms 468 KB Output is correct
12 Correct 104 ms 340 KB Output is correct
13 Correct 106 ms 468 KB Output is correct
14 Runtime error 1 ms 596 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -