# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1004071 |
2024-06-21T04:22:57 Z |
De3b0o |
Team Contest (JOI22_team) |
C++14 |
|
2000 ms |
130640 KB |
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*x)
#define rc (2*x+1)
using namespace std;
ll n;
ll X[150009];
ll Y[150009];
ll Z[150009];
ll ox[150009];
ll oy[150009];
ll oz[150009];
ll mx[4009][4009];
int main()
{
d3
cin >> n;
set<ll> s1 , s2 , s3;
map<ll,ll> mp1 , mp2 , mp3;
for(int i = 0 ; n>i ; i++)
{
cin >> X[i] >> Y[i] >> Z[i];
s1.in(X[i]);
s2.in(Y[i]);
s3.in(Z[i]);
}
ll t = 0;
for(auto it : s1)
{
mp1[it]=t;
ox[t]=it;
t++;
}
t=0;
for(auto it : s2)
{
mp2[it]=t;
oy[t]=it;
t++;
}
t=0;
for(auto it : s3)
{
mp3[it]=t;
oz[t]=it;
t++;
}
for(int i = 0 ; n>i ; i++)
{
X[i]=mp1[X[i]];
Y[i]=mp2[Y[i]];
Z[i]=mp3[Z[i]];
mx[X[i]][Y[i]]=max(mx[X[i]][Y[i]],Z[i]);
}
for(int i = 1 ; 4009 > i ; i++)
mx[i][0]=max(mx[i][0],mx[i-1][0]);
for(int i = 1 ; 4009 > i ; i++)
mx[0][i]=max(mx[0][i],mx[0][i-1]);
for(int i = 1 ; 4009>i ; i++)
for(int j = 1 ; 4009>j ; j++)
mx[i][j]=max(mx[i][j],max(mx[i-1][j],mx[i][j-1]));
ll ans = -1;
for(int i = 0 ; n>i ; i++)
{
for(int j = 0 ; n>j ; j++)
{
if(i==j)
continue;
if(X[i]>X[j]&&Y[j]>Y[i])
{
if(max(Z[i],Z[j])>=mx[X[i]][Y[j]])
continue;
ans=max(ans,ox[X[i]]+oy[Y[j]]+oz[mx[X[i]][Y[i]]]);
}
}
}
cans
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
126036 KB |
Output is correct |
2 |
Correct |
54 ms |
126036 KB |
Output is correct |
3 |
Correct |
51 ms |
126036 KB |
Output is correct |
4 |
Correct |
51 ms |
126032 KB |
Output is correct |
5 |
Correct |
56 ms |
126284 KB |
Output is correct |
6 |
Correct |
58 ms |
126036 KB |
Output is correct |
7 |
Correct |
50 ms |
126036 KB |
Output is correct |
8 |
Correct |
52 ms |
126256 KB |
Output is correct |
9 |
Correct |
52 ms |
126036 KB |
Output is correct |
10 |
Correct |
55 ms |
126032 KB |
Output is correct |
11 |
Correct |
58 ms |
126032 KB |
Output is correct |
12 |
Correct |
68 ms |
126032 KB |
Output is correct |
13 |
Correct |
57 ms |
126036 KB |
Output is correct |
14 |
Correct |
55 ms |
126284 KB |
Output is correct |
15 |
Incorrect |
60 ms |
126292 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
126036 KB |
Output is correct |
2 |
Correct |
54 ms |
126036 KB |
Output is correct |
3 |
Correct |
51 ms |
126036 KB |
Output is correct |
4 |
Correct |
51 ms |
126032 KB |
Output is correct |
5 |
Correct |
56 ms |
126284 KB |
Output is correct |
6 |
Correct |
58 ms |
126036 KB |
Output is correct |
7 |
Correct |
50 ms |
126036 KB |
Output is correct |
8 |
Correct |
52 ms |
126256 KB |
Output is correct |
9 |
Correct |
52 ms |
126036 KB |
Output is correct |
10 |
Correct |
55 ms |
126032 KB |
Output is correct |
11 |
Correct |
58 ms |
126032 KB |
Output is correct |
12 |
Correct |
68 ms |
126032 KB |
Output is correct |
13 |
Correct |
57 ms |
126036 KB |
Output is correct |
14 |
Correct |
55 ms |
126284 KB |
Output is correct |
15 |
Incorrect |
60 ms |
126292 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
126204 KB |
Output is correct |
2 |
Correct |
56 ms |
126172 KB |
Output is correct |
3 |
Correct |
57 ms |
126036 KB |
Output is correct |
4 |
Correct |
57 ms |
126288 KB |
Output is correct |
5 |
Correct |
57 ms |
126264 KB |
Output is correct |
6 |
Correct |
56 ms |
126032 KB |
Output is correct |
7 |
Correct |
69 ms |
126032 KB |
Output is correct |
8 |
Correct |
58 ms |
126036 KB |
Output is correct |
9 |
Correct |
53 ms |
126032 KB |
Output is correct |
10 |
Correct |
55 ms |
126300 KB |
Output is correct |
11 |
Execution timed out |
2033 ms |
130640 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
126204 KB |
Output is correct |
2 |
Correct |
56 ms |
126172 KB |
Output is correct |
3 |
Correct |
57 ms |
126036 KB |
Output is correct |
4 |
Correct |
57 ms |
126288 KB |
Output is correct |
5 |
Correct |
57 ms |
126264 KB |
Output is correct |
6 |
Correct |
56 ms |
126032 KB |
Output is correct |
7 |
Correct |
69 ms |
126032 KB |
Output is correct |
8 |
Correct |
58 ms |
126036 KB |
Output is correct |
9 |
Correct |
53 ms |
126032 KB |
Output is correct |
10 |
Correct |
55 ms |
126300 KB |
Output is correct |
11 |
Execution timed out |
2033 ms |
130640 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
126204 KB |
Output is correct |
2 |
Correct |
56 ms |
126172 KB |
Output is correct |
3 |
Correct |
57 ms |
126036 KB |
Output is correct |
4 |
Correct |
57 ms |
126288 KB |
Output is correct |
5 |
Correct |
57 ms |
126264 KB |
Output is correct |
6 |
Correct |
56 ms |
126032 KB |
Output is correct |
7 |
Correct |
69 ms |
126032 KB |
Output is correct |
8 |
Correct |
58 ms |
126036 KB |
Output is correct |
9 |
Correct |
53 ms |
126032 KB |
Output is correct |
10 |
Correct |
55 ms |
126300 KB |
Output is correct |
11 |
Execution timed out |
2033 ms |
130640 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
126204 KB |
Output is correct |
2 |
Correct |
56 ms |
126172 KB |
Output is correct |
3 |
Correct |
57 ms |
126036 KB |
Output is correct |
4 |
Correct |
57 ms |
126288 KB |
Output is correct |
5 |
Correct |
57 ms |
126264 KB |
Output is correct |
6 |
Correct |
56 ms |
126032 KB |
Output is correct |
7 |
Correct |
69 ms |
126032 KB |
Output is correct |
8 |
Correct |
58 ms |
126036 KB |
Output is correct |
9 |
Correct |
53 ms |
126032 KB |
Output is correct |
10 |
Correct |
55 ms |
126300 KB |
Output is correct |
11 |
Execution timed out |
2033 ms |
130640 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
126036 KB |
Output is correct |
2 |
Correct |
54 ms |
126036 KB |
Output is correct |
3 |
Correct |
51 ms |
126036 KB |
Output is correct |
4 |
Correct |
51 ms |
126032 KB |
Output is correct |
5 |
Correct |
56 ms |
126284 KB |
Output is correct |
6 |
Correct |
58 ms |
126036 KB |
Output is correct |
7 |
Correct |
50 ms |
126036 KB |
Output is correct |
8 |
Correct |
52 ms |
126256 KB |
Output is correct |
9 |
Correct |
52 ms |
126036 KB |
Output is correct |
10 |
Correct |
55 ms |
126032 KB |
Output is correct |
11 |
Correct |
58 ms |
126032 KB |
Output is correct |
12 |
Correct |
68 ms |
126032 KB |
Output is correct |
13 |
Correct |
57 ms |
126036 KB |
Output is correct |
14 |
Correct |
55 ms |
126284 KB |
Output is correct |
15 |
Incorrect |
60 ms |
126292 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |