Submission #713816

# Submission time Handle Problem Language Result Execution time Memory
713816 2023-03-23T05:32:01 Z 089487 Team Contest (JOI22_team) C++14
8 / 100
2000 ms 3752 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include<bits/stdc++.h>
#define int long long
#define quick ios::sync_with_stdio(0);cin.tie(0);
#define rep(x,a,b) for(int x=a;x<=b;x++)
#define repd(x,a,b) for(int x=a;x>=b;x--)
#define lowbit(x) (x&-x)
#define sz(x) (int)(x.size())
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define mp make_pair
#define eb emplace_back
using namespace std;
typedef pair<int,int> pii;
void debug(){
    cout<<"\n";
}
template <class T,class ... U >
void debug(T a, U ... b){
    cout<<a<<" ",debug(b...);
}
const int N=2e5+7;
const int INF=1e18;
int p[3][N];
int get(int a,int b,int c,int idx){
	if(p[idx][a]<p[idx][b]) swap(a,b);
	if(p[idx][a]<p[idx][c]) swap(a,c);
	if(p[idx][a]==p[idx][b]||p[idx][a]==p[idx][c]) return -1;
	return a;
}

signed main(){
	quick
	int n;
	cin>>n;
	rep(i,1,n){
		rep(j,0,2) cin>>p[j][i];
	}
	int ans=-1;
	rep(i,1,n){
		rep(j,i+1,n){
			rep(z,j+1,n){
				int px[3];
				bool ok=true;
				int sum=0;
				rep(d,0,2) {
					px[d]=get(i,j,z,d);
					sum+=p[d][px[d]];
					if(px[d]==-1) ok=false;
					rep(d2,0,d-1){
						if(px[d]==px[d2]) ok=false;
					}
				}
				if(ok) ans=max(ans,sum);
			}
		}
	}
	cout<<ans<<"\n";

	return 0;
}

Compilation message

team.cpp: In function 'int main()':
team.cpp:50:21: warning: array subscript -1 is below array bounds of 'long long int [200007]' [-Warray-bounds]
   50 |      sum+=p[d][px[d]];
      |           ~~~~~~~~~~^
# 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 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 57 ms 340 KB Output is correct
15 Correct 27 ms 340 KB Output is correct
16 Correct 41 ms 340 KB Output is correct
17 Correct 51 ms 340 KB Output is correct
18 Correct 49 ms 320 KB Output is correct
19 Correct 57 ms 340 KB Output is correct
20 Correct 66 ms 340 KB Output is correct
21 Correct 48 ms 340 KB Output is correct
22 Correct 32 ms 348 KB Output is correct
23 Correct 23 ms 340 KB Output is correct
24 Correct 31 ms 340 KB Output is correct
25 Correct 32 ms 340 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 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 57 ms 340 KB Output is correct
15 Correct 27 ms 340 KB Output is correct
16 Correct 41 ms 340 KB Output is correct
17 Correct 51 ms 340 KB Output is correct
18 Correct 49 ms 320 KB Output is correct
19 Correct 57 ms 340 KB Output is correct
20 Correct 66 ms 340 KB Output is correct
21 Correct 48 ms 340 KB Output is correct
22 Correct 32 ms 348 KB Output is correct
23 Correct 23 ms 340 KB Output is correct
24 Correct 31 ms 340 KB Output is correct
25 Correct 32 ms 340 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 1 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 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Execution timed out 2074 ms 3752 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Execution timed out 2074 ms 3752 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Execution timed out 2074 ms 3752 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Execution timed out 2074 ms 3752 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 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 57 ms 340 KB Output is correct
15 Correct 27 ms 340 KB Output is correct
16 Correct 41 ms 340 KB Output is correct
17 Correct 51 ms 340 KB Output is correct
18 Correct 49 ms 320 KB Output is correct
19 Correct 57 ms 340 KB Output is correct
20 Correct 66 ms 340 KB Output is correct
21 Correct 48 ms 340 KB Output is correct
22 Correct 32 ms 348 KB Output is correct
23 Correct 23 ms 340 KB Output is correct
24 Correct 31 ms 340 KB Output is correct
25 Correct 32 ms 340 KB Output is correct
26 Execution timed out 2075 ms 340 KB Time limit exceeded
27 Halted 0 ms 0 KB -