답안 #879058

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879058 2023-11-26T08:20:30 Z 8pete8 Team Contest (JOI22_team) C++14
0 / 100
57 ms 11924 KB
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<pii,int>
#define vi vector<int>
#define pb push_back
//#define p push
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
using namespace std;
#define int long long
const int mod=9901,mxn=3*1e5+5,inf=1e18,lg=30,minf=-1e18;
vector<pii>v[3];
vector<int>e[3];
int cnt[3];
bitset<mxn+10>del;
int32_t main(){
	fastio
	int n,a;cin>>n;
	for(int i=0;i<3;i++)e[i].resize(n),v[i].resize(n);
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++)cin>>e[j][i],v[j][i]={e[j][i],i};
	}
	for(int j=0;j<3;j++)sort(rall(v[j]));
	while(cnt[0]<n&&cnt[1]<n&&cnt[2]<n){
		bool yes=false;
		for(int i=0;i<3;i++)for(int j=0;j<3;j++)if(i!=j&&e[i][v[i][cnt[i]].s]==e[i][v[j][cnt[j]].s])del[v[i][cnt[i]].s]=del[v[j][cnt[j]].s]=true;
		for(int i=0;i<3;i++)if(del[v[i][cnt[i]].s])cnt[i]++,yes=true;
		if(!yes){
			cout<<v[0][cnt[0]].f+v[1][cnt[1]].f+v[2][cnt[2]].f;
			return 0;
		}
	}
	cout<<-1;
}

Compilation message

team.cpp:30:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   30 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
team.cpp:38:14: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   38 | int32_t main(){
      |              ^
team.cpp: In function 'int32_t main()':
team.cpp:40:8: warning: unused variable 'a' [-Wunused-variable]
   40 |  int n,a;cin>>n;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 360 KB Output is correct
16 Correct 0 ms 352 KB Output is correct
17 Correct 0 ms 352 KB Output is correct
18 Correct 0 ms 352 KB Output is correct
19 Correct 1 ms 352 KB Output is correct
20 Correct 1 ms 352 KB Output is correct
21 Correct 0 ms 484 KB Output is correct
22 Correct 0 ms 356 KB Output is correct
23 Correct 0 ms 356 KB Output is correct
24 Correct 1 ms 356 KB Output is correct
25 Incorrect 1 ms 360 KB Output isn't correct
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 360 KB Output is correct
16 Correct 0 ms 352 KB Output is correct
17 Correct 0 ms 352 KB Output is correct
18 Correct 0 ms 352 KB Output is correct
19 Correct 1 ms 352 KB Output is correct
20 Correct 1 ms 352 KB Output is correct
21 Correct 0 ms 484 KB Output is correct
22 Correct 0 ms 356 KB Output is correct
23 Correct 0 ms 356 KB Output is correct
24 Correct 1 ms 356 KB Output is correct
25 Incorrect 1 ms 360 KB Output isn't correct
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 0 ms 472 KB Output is correct
3 Correct 0 ms 472 KB Output is correct
4 Correct 1 ms 360 KB Output is correct
5 Correct 0 ms 356 KB Output is correct
6 Correct 0 ms 360 KB Output is correct
7 Correct 0 ms 352 KB Output is correct
8 Correct 0 ms 472 KB Output is correct
9 Correct 0 ms 360 KB Output is correct
10 Correct 0 ms 360 KB Output is correct
11 Correct 57 ms 11924 KB Output is correct
12 Incorrect 41 ms 8040 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 0 ms 472 KB Output is correct
3 Correct 0 ms 472 KB Output is correct
4 Correct 1 ms 360 KB Output is correct
5 Correct 0 ms 356 KB Output is correct
6 Correct 0 ms 360 KB Output is correct
7 Correct 0 ms 352 KB Output is correct
8 Correct 0 ms 472 KB Output is correct
9 Correct 0 ms 360 KB Output is correct
10 Correct 0 ms 360 KB Output is correct
11 Correct 57 ms 11924 KB Output is correct
12 Incorrect 41 ms 8040 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 0 ms 472 KB Output is correct
3 Correct 0 ms 472 KB Output is correct
4 Correct 1 ms 360 KB Output is correct
5 Correct 0 ms 356 KB Output is correct
6 Correct 0 ms 360 KB Output is correct
7 Correct 0 ms 352 KB Output is correct
8 Correct 0 ms 472 KB Output is correct
9 Correct 0 ms 360 KB Output is correct
10 Correct 0 ms 360 KB Output is correct
11 Correct 57 ms 11924 KB Output is correct
12 Incorrect 41 ms 8040 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 0 ms 472 KB Output is correct
3 Correct 0 ms 472 KB Output is correct
4 Correct 1 ms 360 KB Output is correct
5 Correct 0 ms 356 KB Output is correct
6 Correct 0 ms 360 KB Output is correct
7 Correct 0 ms 352 KB Output is correct
8 Correct 0 ms 472 KB Output is correct
9 Correct 0 ms 360 KB Output is correct
10 Correct 0 ms 360 KB Output is correct
11 Correct 57 ms 11924 KB Output is correct
12 Incorrect 41 ms 8040 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 360 KB Output is correct
16 Correct 0 ms 352 KB Output is correct
17 Correct 0 ms 352 KB Output is correct
18 Correct 0 ms 352 KB Output is correct
19 Correct 1 ms 352 KB Output is correct
20 Correct 1 ms 352 KB Output is correct
21 Correct 0 ms 484 KB Output is correct
22 Correct 0 ms 356 KB Output is correct
23 Correct 0 ms 356 KB Output is correct
24 Correct 1 ms 356 KB Output is correct
25 Incorrect 1 ms 360 KB Output isn't correct
26 Halted 0 ms 0 KB -