# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
591882 |
2022-07-08T05:47:50 Z |
반딧불(#8422) |
Team Contest (JOI22_team) |
C++17 |
|
2000 ms |
64708 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct segTree{
int tree[600002];
void init(int i, int l, int r){
tree[i] = -1e9;
if(l==r) return;
int m = (l+r)>>1;
init(i*2, l, m), init(i*2+1, m+1, r);
}
void update(int i, int l, int r, int x, int v){
if(l==r){
tree[i] = max(tree[i], v);
return;
}
int m = (l+r)>>1;
if(x<=m) update(i*2, l, m, x, v);
else update(i*2+1, m+1, r, x, v);
tree[i] = max(tree[i*2], tree[i*2+1]);
}
int query(int i, int l, int r, int s, int e){
if(r<s || e<l) return -1e9;
if(s<=l && r<=e) return tree[i];
int m = (l+r)>>1;
return max(query(i*2, l, m, s, e), query(i*2+1, m+1, r, s, e));
}
} tree;
int n;
int x[150002], y[150002], z[150002];
int yIdx[150002];
int ans = -1;
int mat[4002][4002];
int main(){
scanf("%d", &n);
for(int i=1; i<=n; i++){
scanf("%d %d %d", &x[i], &y[i], &z[i]);
mat[x[i]][y[i]] = max(mat[x[i]][y[i]], z[i]);
}
for(int i=1; i<=4000; i++){
for(int j=1; j<=4000; j++){
mat[i][j] = max({mat[i][j], mat[i-1][j], mat[i][j-1]});
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
if(i==j) continue;
if(x[i] <= x[j] || y[i] >= y[j]) continue;
int tmp = mat[x[i]-1][y[j]-1];
if(tmp > z[i] && tmp > z[j]) ans = max(ans, x[i]+y[j]+tmp);
}
}
printf("%d", ans);
}
Compilation message
team.cpp: In function 'int main()':
team.cpp:44:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
44 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
team.cpp:46:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
46 | scanf("%d %d %d", &x[i], &y[i], &z[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
62952 KB |
Output is correct |
2 |
Correct |
86 ms |
62876 KB |
Output is correct |
3 |
Correct |
88 ms |
62904 KB |
Output is correct |
4 |
Correct |
90 ms |
62964 KB |
Output is correct |
5 |
Correct |
88 ms |
62924 KB |
Output is correct |
6 |
Correct |
86 ms |
62960 KB |
Output is correct |
7 |
Correct |
84 ms |
62860 KB |
Output is correct |
8 |
Correct |
92 ms |
62968 KB |
Output is correct |
9 |
Correct |
91 ms |
62948 KB |
Output is correct |
10 |
Correct |
85 ms |
62932 KB |
Output is correct |
11 |
Correct |
86 ms |
63052 KB |
Output is correct |
12 |
Correct |
83 ms |
62992 KB |
Output is correct |
13 |
Correct |
86 ms |
62872 KB |
Output is correct |
14 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
62952 KB |
Output is correct |
2 |
Correct |
86 ms |
62876 KB |
Output is correct |
3 |
Correct |
88 ms |
62904 KB |
Output is correct |
4 |
Correct |
90 ms |
62964 KB |
Output is correct |
5 |
Correct |
88 ms |
62924 KB |
Output is correct |
6 |
Correct |
86 ms |
62960 KB |
Output is correct |
7 |
Correct |
84 ms |
62860 KB |
Output is correct |
8 |
Correct |
92 ms |
62968 KB |
Output is correct |
9 |
Correct |
91 ms |
62948 KB |
Output is correct |
10 |
Correct |
85 ms |
62932 KB |
Output is correct |
11 |
Correct |
86 ms |
63052 KB |
Output is correct |
12 |
Correct |
83 ms |
62992 KB |
Output is correct |
13 |
Correct |
86 ms |
62872 KB |
Output is correct |
14 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
62876 KB |
Output is correct |
2 |
Correct |
87 ms |
62916 KB |
Output is correct |
3 |
Correct |
86 ms |
62896 KB |
Output is correct |
4 |
Correct |
93 ms |
63004 KB |
Output is correct |
5 |
Correct |
88 ms |
62908 KB |
Output is correct |
6 |
Correct |
88 ms |
62916 KB |
Output is correct |
7 |
Correct |
92 ms |
62924 KB |
Output is correct |
8 |
Correct |
93 ms |
62968 KB |
Output is correct |
9 |
Correct |
91 ms |
62976 KB |
Output is correct |
10 |
Correct |
86 ms |
62936 KB |
Output is correct |
11 |
Execution timed out |
2080 ms |
64708 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
62876 KB |
Output is correct |
2 |
Correct |
87 ms |
62916 KB |
Output is correct |
3 |
Correct |
86 ms |
62896 KB |
Output is correct |
4 |
Correct |
93 ms |
63004 KB |
Output is correct |
5 |
Correct |
88 ms |
62908 KB |
Output is correct |
6 |
Correct |
88 ms |
62916 KB |
Output is correct |
7 |
Correct |
92 ms |
62924 KB |
Output is correct |
8 |
Correct |
93 ms |
62968 KB |
Output is correct |
9 |
Correct |
91 ms |
62976 KB |
Output is correct |
10 |
Correct |
86 ms |
62936 KB |
Output is correct |
11 |
Execution timed out |
2080 ms |
64708 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
62876 KB |
Output is correct |
2 |
Correct |
87 ms |
62916 KB |
Output is correct |
3 |
Correct |
86 ms |
62896 KB |
Output is correct |
4 |
Correct |
93 ms |
63004 KB |
Output is correct |
5 |
Correct |
88 ms |
62908 KB |
Output is correct |
6 |
Correct |
88 ms |
62916 KB |
Output is correct |
7 |
Correct |
92 ms |
62924 KB |
Output is correct |
8 |
Correct |
93 ms |
62968 KB |
Output is correct |
9 |
Correct |
91 ms |
62976 KB |
Output is correct |
10 |
Correct |
86 ms |
62936 KB |
Output is correct |
11 |
Execution timed out |
2080 ms |
64708 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
62876 KB |
Output is correct |
2 |
Correct |
87 ms |
62916 KB |
Output is correct |
3 |
Correct |
86 ms |
62896 KB |
Output is correct |
4 |
Correct |
93 ms |
63004 KB |
Output is correct |
5 |
Correct |
88 ms |
62908 KB |
Output is correct |
6 |
Correct |
88 ms |
62916 KB |
Output is correct |
7 |
Correct |
92 ms |
62924 KB |
Output is correct |
8 |
Correct |
93 ms |
62968 KB |
Output is correct |
9 |
Correct |
91 ms |
62976 KB |
Output is correct |
10 |
Correct |
86 ms |
62936 KB |
Output is correct |
11 |
Execution timed out |
2080 ms |
64708 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
62952 KB |
Output is correct |
2 |
Correct |
86 ms |
62876 KB |
Output is correct |
3 |
Correct |
88 ms |
62904 KB |
Output is correct |
4 |
Correct |
90 ms |
62964 KB |
Output is correct |
5 |
Correct |
88 ms |
62924 KB |
Output is correct |
6 |
Correct |
86 ms |
62960 KB |
Output is correct |
7 |
Correct |
84 ms |
62860 KB |
Output is correct |
8 |
Correct |
92 ms |
62968 KB |
Output is correct |
9 |
Correct |
91 ms |
62948 KB |
Output is correct |
10 |
Correct |
85 ms |
62932 KB |
Output is correct |
11 |
Correct |
86 ms |
63052 KB |
Output is correct |
12 |
Correct |
83 ms |
62992 KB |
Output is correct |
13 |
Correct |
86 ms |
62872 KB |
Output is correct |
14 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |