# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
556203 | 2022-05-02T15:11:37 Z | 600Mihnea | Team Contest (JOI22_team) | C++17 | 2000 ms | 2004 KB |
#include <bits/stdc++.h> bool home = 1; using namespace std; struct T { int x; int y; int z; }; bool cmp_x_inv(T a,T b) { return a.x>b.x; } typedef long long ll; const int N=150000+7; const int INF=(int)1e9+7; int n; T a[N]; signed main() { #ifdef ONLINE_JUDGE home = 0; #endif home=0; if (home) { freopen("I_am_iron_man", "r", stdin); } else { ios::sync_with_stdio(0); cin.tie(0); } cin>>n; for (int i=1;i<=n;i++) { cin>>a[i].x>>a[i].y>>a[i].z; } sort(a+1,a+n+1,cmp_x_inv); int print=-1; for (int ITER=0;ITER<2;ITER++) { int last=n; while(last>=1){ int first=last; while(first-1>=1&&a[first-1].x==a[first].x) first--; for (int i=first;i<=last;i++) { int sol=-INF; int y=a[i].y,z=a[i].z; for (int j=last+1;j<=n;j++) { for (int k=j+1;k<=n;k++) { if (a[j].y>max(y,a[k].y) && a[k].z>max(z,a[j].z)) sol=max(sol,a[j].y+a[k].z); } } print=max(print,sol+a[i].x); } last=first-1; } for (int i=1;i<=n;i++) swap(a[i].y,a[i].z); } cout<<print<<"\n"; }
Compilation message
# | 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 | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
14 | Correct | 20 ms | 332 KB | Output is correct |
15 | Correct | 6 ms | 340 KB | Output is correct |
16 | Correct | 10 ms | 332 KB | Output is correct |
17 | Correct | 11 ms | 212 KB | Output is correct |
18 | Correct | 14 ms | 332 KB | Output is correct |
19 | Correct | 18 ms | 340 KB | Output is correct |
20 | Correct | 12 ms | 212 KB | Output is correct |
21 | Correct | 4 ms | 340 KB | Output is correct |
22 | Correct | 8 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 212 KB | Output is correct |
24 | Correct | 8 ms | 336 KB | Output is correct |
25 | Correct | 8 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 | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
14 | Correct | 20 ms | 332 KB | Output is correct |
15 | Correct | 6 ms | 340 KB | Output is correct |
16 | Correct | 10 ms | 332 KB | Output is correct |
17 | Correct | 11 ms | 212 KB | Output is correct |
18 | Correct | 14 ms | 332 KB | Output is correct |
19 | Correct | 18 ms | 340 KB | Output is correct |
20 | Correct | 12 ms | 212 KB | Output is correct |
21 | Correct | 4 ms | 340 KB | Output is correct |
22 | Correct | 8 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 212 KB | Output is correct |
24 | Correct | 8 ms | 336 KB | Output is correct |
25 | Correct | 8 ms | 212 KB | Output is correct |
26 | Execution timed out | 2075 ms | 340 KB | Time limit exceeded |
27 | Halted | 0 ms | 0 KB | - |
# | 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 | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 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 | Execution timed out | 2077 ms | 2004 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 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 | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 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 | Execution timed out | 2077 ms | 2004 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 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 | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 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 | Execution timed out | 2077 ms | 2004 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 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 | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 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 | Execution timed out | 2077 ms | 2004 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 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 | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
14 | Correct | 20 ms | 332 KB | Output is correct |
15 | Correct | 6 ms | 340 KB | Output is correct |
16 | Correct | 10 ms | 332 KB | Output is correct |
17 | Correct | 11 ms | 212 KB | Output is correct |
18 | Correct | 14 ms | 332 KB | Output is correct |
19 | Correct | 18 ms | 340 KB | Output is correct |
20 | Correct | 12 ms | 212 KB | Output is correct |
21 | Correct | 4 ms | 340 KB | Output is correct |
22 | Correct | 8 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 212 KB | Output is correct |
24 | Correct | 8 ms | 336 KB | Output is correct |
25 | Correct | 8 ms | 212 KB | Output is correct |
26 | Execution timed out | 2075 ms | 340 KB | Time limit exceeded |
27 | Halted | 0 ms | 0 KB | - |