#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define pb push_back
#define pow poww
const int M=301;
const ll mod=998244353;
const ll inf=2e18;
const ll dx[]={1,-1,0,0};
const ll dy[]={0,0,1,-1};
ll pow(ll x,ll y){
ll res=1;
x%=mod;
while(y>0){
if(y%2==1){
res*=x,res%=mod;
}
x*=x,x%=mod;
y/=2;
}
return res;
}
ll n,ma[M][M][M][3];
int main(){
ios_base::sync_with_stdio(0),cin.tie(0);
ll TC=1;
//cin>>TC;
while(TC--){
cin>>n;
for(int i=0;i<n;i++){
ll x,y,z;
cin>>x>>y>>z;
ma[x][y][z][0]=ma[x][y][z][1]=ma[x][y][z][2]=1;;
}
for(int i=1;i<=300;i++){
for(int j=1;j<=300;j++){
for(int k=1;k<=300;k++){
ma[i][j][k][0]|=ma[i][j-1][k][0];
ma[i][j][k][0]|=ma[i][j][k-1][0];
ma[i][j][k][1]|=ma[i-1][j][k][1];
ma[i][j][k][1]|=ma[i][j][k-1][1];
ma[i][j][k][2]|=ma[i-1][j][k][2];
ma[i][j][k][2]|=ma[i][j-1][k][2];
}
}
}
int ans=-1;
for(int i=1;i<=300;i++){
for(int j=1;j<=300;j++){
for(int k=1;k<=300;k++){
if(ma[i][j-1][k-1][0]&&ma[i-1][j][k-1][1]&&ma[i-1][j-1][k][2])
ans=max(ans,i+j+k);
}
}
}
cout<<ans;
}
return 0;
}
/*
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
639572 KB |
Output is correct |
2 |
Correct |
350 ms |
639712 KB |
Output is correct |
3 |
Correct |
347 ms |
639572 KB |
Output is correct |
4 |
Correct |
370 ms |
639568 KB |
Output is correct |
5 |
Correct |
367 ms |
639568 KB |
Output is correct |
6 |
Correct |
356 ms |
639568 KB |
Output is correct |
7 |
Correct |
360 ms |
639600 KB |
Output is correct |
8 |
Correct |
351 ms |
639700 KB |
Output is correct |
9 |
Correct |
338 ms |
637780 KB |
Output is correct |
10 |
Correct |
370 ms |
637728 KB |
Output is correct |
11 |
Correct |
354 ms |
637764 KB |
Output is correct |
12 |
Correct |
354 ms |
637860 KB |
Output is correct |
13 |
Correct |
348 ms |
639568 KB |
Output is correct |
14 |
Runtime error |
8 ms |
472 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
639572 KB |
Output is correct |
2 |
Correct |
350 ms |
639712 KB |
Output is correct |
3 |
Correct |
347 ms |
639572 KB |
Output is correct |
4 |
Correct |
370 ms |
639568 KB |
Output is correct |
5 |
Correct |
367 ms |
639568 KB |
Output is correct |
6 |
Correct |
356 ms |
639568 KB |
Output is correct |
7 |
Correct |
360 ms |
639600 KB |
Output is correct |
8 |
Correct |
351 ms |
639700 KB |
Output is correct |
9 |
Correct |
338 ms |
637780 KB |
Output is correct |
10 |
Correct |
370 ms |
637728 KB |
Output is correct |
11 |
Correct |
354 ms |
637764 KB |
Output is correct |
12 |
Correct |
354 ms |
637860 KB |
Output is correct |
13 |
Correct |
348 ms |
639568 KB |
Output is correct |
14 |
Runtime error |
8 ms |
472 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
355 ms |
639680 KB |
Output is correct |
2 |
Correct |
341 ms |
639536 KB |
Output is correct |
3 |
Correct |
376 ms |
639568 KB |
Output is correct |
4 |
Correct |
347 ms |
639572 KB |
Output is correct |
5 |
Correct |
321 ms |
639700 KB |
Output is correct |
6 |
Correct |
324 ms |
639572 KB |
Output is correct |
7 |
Correct |
337 ms |
639772 KB |
Output is correct |
8 |
Correct |
350 ms |
639596 KB |
Output is correct |
9 |
Correct |
344 ms |
637752 KB |
Output is correct |
10 |
Correct |
343 ms |
637776 KB |
Output is correct |
11 |
Correct |
369 ms |
640604 KB |
Output is correct |
12 |
Correct |
339 ms |
640336 KB |
Output is correct |
13 |
Correct |
430 ms |
640596 KB |
Output is correct |
14 |
Correct |
352 ms |
640596 KB |
Output is correct |
15 |
Correct |
388 ms |
640592 KB |
Output is correct |
16 |
Correct |
359 ms |
640596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
355 ms |
639680 KB |
Output is correct |
2 |
Correct |
341 ms |
639536 KB |
Output is correct |
3 |
Correct |
376 ms |
639568 KB |
Output is correct |
4 |
Correct |
347 ms |
639572 KB |
Output is correct |
5 |
Correct |
321 ms |
639700 KB |
Output is correct |
6 |
Correct |
324 ms |
639572 KB |
Output is correct |
7 |
Correct |
337 ms |
639772 KB |
Output is correct |
8 |
Correct |
350 ms |
639596 KB |
Output is correct |
9 |
Correct |
344 ms |
637752 KB |
Output is correct |
10 |
Correct |
343 ms |
637776 KB |
Output is correct |
11 |
Correct |
369 ms |
640604 KB |
Output is correct |
12 |
Correct |
339 ms |
640336 KB |
Output is correct |
13 |
Correct |
430 ms |
640596 KB |
Output is correct |
14 |
Correct |
352 ms |
640596 KB |
Output is correct |
15 |
Correct |
388 ms |
640592 KB |
Output is correct |
16 |
Correct |
359 ms |
640596 KB |
Output is correct |
17 |
Correct |
360 ms |
637640 KB |
Output is correct |
18 |
Correct |
334 ms |
637776 KB |
Output is correct |
19 |
Correct |
334 ms |
639572 KB |
Output is correct |
20 |
Correct |
321 ms |
639572 KB |
Output is correct |
21 |
Correct |
366 ms |
639692 KB |
Output is correct |
22 |
Correct |
340 ms |
640848 KB |
Output is correct |
23 |
Correct |
346 ms |
640544 KB |
Output is correct |
24 |
Correct |
348 ms |
640340 KB |
Output is correct |
25 |
Correct |
339 ms |
640944 KB |
Output is correct |
26 |
Correct |
352 ms |
640712 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
355 ms |
639680 KB |
Output is correct |
2 |
Correct |
341 ms |
639536 KB |
Output is correct |
3 |
Correct |
376 ms |
639568 KB |
Output is correct |
4 |
Correct |
347 ms |
639572 KB |
Output is correct |
5 |
Correct |
321 ms |
639700 KB |
Output is correct |
6 |
Correct |
324 ms |
639572 KB |
Output is correct |
7 |
Correct |
337 ms |
639772 KB |
Output is correct |
8 |
Correct |
350 ms |
639596 KB |
Output is correct |
9 |
Correct |
344 ms |
637752 KB |
Output is correct |
10 |
Correct |
343 ms |
637776 KB |
Output is correct |
11 |
Correct |
369 ms |
640604 KB |
Output is correct |
12 |
Correct |
339 ms |
640336 KB |
Output is correct |
13 |
Correct |
430 ms |
640596 KB |
Output is correct |
14 |
Correct |
352 ms |
640596 KB |
Output is correct |
15 |
Correct |
388 ms |
640592 KB |
Output is correct |
16 |
Correct |
359 ms |
640596 KB |
Output is correct |
17 |
Correct |
360 ms |
637640 KB |
Output is correct |
18 |
Correct |
334 ms |
637776 KB |
Output is correct |
19 |
Correct |
334 ms |
639572 KB |
Output is correct |
20 |
Correct |
321 ms |
639572 KB |
Output is correct |
21 |
Correct |
366 ms |
639692 KB |
Output is correct |
22 |
Correct |
340 ms |
640848 KB |
Output is correct |
23 |
Correct |
346 ms |
640544 KB |
Output is correct |
24 |
Correct |
348 ms |
640340 KB |
Output is correct |
25 |
Correct |
339 ms |
640944 KB |
Output is correct |
26 |
Correct |
352 ms |
640712 KB |
Output is correct |
27 |
Correct |
269 ms |
638036 KB |
Output is correct |
28 |
Correct |
289 ms |
639824 KB |
Output is correct |
29 |
Correct |
297 ms |
639908 KB |
Output is correct |
30 |
Correct |
272 ms |
639824 KB |
Output is correct |
31 |
Correct |
254 ms |
638260 KB |
Output is correct |
32 |
Correct |
232 ms |
640340 KB |
Output is correct |
33 |
Correct |
237 ms |
638288 KB |
Output is correct |
34 |
Correct |
269 ms |
639884 KB |
Output is correct |
35 |
Correct |
285 ms |
639664 KB |
Output is correct |
36 |
Correct |
290 ms |
639868 KB |
Output is correct |
37 |
Correct |
255 ms |
639844 KB |
Output is correct |
38 |
Correct |
246 ms |
639824 KB |
Output is correct |
39 |
Correct |
323 ms |
638784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
355 ms |
639680 KB |
Output is correct |
2 |
Correct |
341 ms |
639536 KB |
Output is correct |
3 |
Correct |
376 ms |
639568 KB |
Output is correct |
4 |
Correct |
347 ms |
639572 KB |
Output is correct |
5 |
Correct |
321 ms |
639700 KB |
Output is correct |
6 |
Correct |
324 ms |
639572 KB |
Output is correct |
7 |
Correct |
337 ms |
639772 KB |
Output is correct |
8 |
Correct |
350 ms |
639596 KB |
Output is correct |
9 |
Correct |
344 ms |
637752 KB |
Output is correct |
10 |
Correct |
343 ms |
637776 KB |
Output is correct |
11 |
Correct |
369 ms |
640604 KB |
Output is correct |
12 |
Correct |
339 ms |
640336 KB |
Output is correct |
13 |
Correct |
430 ms |
640596 KB |
Output is correct |
14 |
Correct |
352 ms |
640596 KB |
Output is correct |
15 |
Correct |
388 ms |
640592 KB |
Output is correct |
16 |
Correct |
359 ms |
640596 KB |
Output is correct |
17 |
Correct |
360 ms |
637640 KB |
Output is correct |
18 |
Correct |
334 ms |
637776 KB |
Output is correct |
19 |
Correct |
334 ms |
639572 KB |
Output is correct |
20 |
Correct |
321 ms |
639572 KB |
Output is correct |
21 |
Correct |
366 ms |
639692 KB |
Output is correct |
22 |
Correct |
340 ms |
640848 KB |
Output is correct |
23 |
Correct |
346 ms |
640544 KB |
Output is correct |
24 |
Correct |
348 ms |
640340 KB |
Output is correct |
25 |
Correct |
339 ms |
640944 KB |
Output is correct |
26 |
Correct |
352 ms |
640712 KB |
Output is correct |
27 |
Correct |
269 ms |
638036 KB |
Output is correct |
28 |
Correct |
289 ms |
639824 KB |
Output is correct |
29 |
Correct |
297 ms |
639908 KB |
Output is correct |
30 |
Correct |
272 ms |
639824 KB |
Output is correct |
31 |
Correct |
254 ms |
638260 KB |
Output is correct |
32 |
Correct |
232 ms |
640340 KB |
Output is correct |
33 |
Correct |
237 ms |
638288 KB |
Output is correct |
34 |
Correct |
269 ms |
639884 KB |
Output is correct |
35 |
Correct |
285 ms |
639664 KB |
Output is correct |
36 |
Correct |
290 ms |
639868 KB |
Output is correct |
37 |
Correct |
255 ms |
639844 KB |
Output is correct |
38 |
Correct |
246 ms |
639824 KB |
Output is correct |
39 |
Correct |
323 ms |
638784 KB |
Output is correct |
40 |
Runtime error |
8 ms |
344 KB |
Execution killed with signal 11 |
41 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
639572 KB |
Output is correct |
2 |
Correct |
350 ms |
639712 KB |
Output is correct |
3 |
Correct |
347 ms |
639572 KB |
Output is correct |
4 |
Correct |
370 ms |
639568 KB |
Output is correct |
5 |
Correct |
367 ms |
639568 KB |
Output is correct |
6 |
Correct |
356 ms |
639568 KB |
Output is correct |
7 |
Correct |
360 ms |
639600 KB |
Output is correct |
8 |
Correct |
351 ms |
639700 KB |
Output is correct |
9 |
Correct |
338 ms |
637780 KB |
Output is correct |
10 |
Correct |
370 ms |
637728 KB |
Output is correct |
11 |
Correct |
354 ms |
637764 KB |
Output is correct |
12 |
Correct |
354 ms |
637860 KB |
Output is correct |
13 |
Correct |
348 ms |
639568 KB |
Output is correct |
14 |
Runtime error |
8 ms |
472 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |