답안 #879079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
879079 2023-11-26T09:18:21 Z 8pete8 Team Contest (JOI22_team) C++14
100 / 100
90 ms 8528 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>
#include <numeric>
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;
const int mod=9901,mxn=2e5+5;
bool del[mxn+10];
int x[mxn+10],y[mxn+10],z[mxn+10];
int32_t main(){
	fastio
	int n;cin>>n;
	vector<int>a(n),b(n),c(n);
	iota(all(a),0);
	iota(all(b),0);
	iota(all(c),0);
	for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>z[i];
	sort(all(a),[&](int i,int j){return x[i]>x[j];});
	sort(all(b),[&](int i,int j){return y[i]>y[j];});
	sort(all(c),[&](int i,int j){return z[i]>z[j];});
	int i=0,j=0,k=0;
	while(i<n&&j<n&&k<n){
		if(del[a[i]])i++;
		else if(del[b[j]])j++;
		else if(del[c[k]])k++;
		else if(z[a[i]]==z[c[k]]||y[a[i]]==y[b[j]])del[a[i]]=1;
		else if(x[a[i]]==x[b[j]]||z[c[k]]==z[b[j]])del[b[j]]=1;
		else if(x[a[i]]==x[c[k]]||y[c[k]]==y[b[j]])del[c[k]]=1;
		else {cout<<x[a[i]]+y[b[j]]+z[c[k]];return 0;}
	}
	cout<<-1;
	return 0;
}

Compilation message

team.cpp:31:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
   31 | #pragma GCC optimize ("03,unroll-lopps")
      |                                        ^
team.cpp:36:14: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   36 | int32_t main(){
      |              ^
team.cpp: In function 'int32_t main()':
team.cpp:44:29: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   44 |  sort(all(a),[&](int i,int j){return x[i]>x[j];});
      |                             ^
team.cpp:45:29: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   45 |  sort(all(b),[&](int i,int j){return y[i]>y[j];});
      |                             ^
team.cpp:46:29: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
   46 |  sort(all(c),[&](int i,int j){return z[i]>z[j];});
      |                             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2548 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2548 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 2 ms 2652 KB Output is correct
28 Correct 2 ms 2652 KB Output is correct
29 Correct 3 ms 2652 KB Output is correct
30 Correct 2 ms 2396 KB Output is correct
31 Correct 3 ms 2392 KB Output is correct
32 Correct 2 ms 2396 KB Output is correct
33 Correct 2 ms 2652 KB Output is correct
34 Correct 2 ms 2652 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2528 KB Output is correct
38 Correct 2 ms 2620 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 37 ms 4444 KB Output is correct
12 Correct 28 ms 3880 KB Output is correct
13 Correct 29 ms 4872 KB Output is correct
14 Correct 39 ms 5328 KB Output is correct
15 Correct 35 ms 5460 KB Output is correct
16 Correct 34 ms 5464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 37 ms 4444 KB Output is correct
12 Correct 28 ms 3880 KB Output is correct
13 Correct 29 ms 4872 KB Output is correct
14 Correct 39 ms 5328 KB Output is correct
15 Correct 35 ms 5460 KB Output is correct
16 Correct 34 ms 5464 KB Output is correct
17 Correct 1 ms 2484 KB Output is correct
18 Correct 1 ms 2580 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2392 KB Output is correct
22 Correct 44 ms 5576 KB Output is correct
23 Correct 40 ms 5320 KB Output is correct
24 Correct 33 ms 4700 KB Output is correct
25 Correct 46 ms 5716 KB Output is correct
26 Correct 36 ms 5460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 37 ms 4444 KB Output is correct
12 Correct 28 ms 3880 KB Output is correct
13 Correct 29 ms 4872 KB Output is correct
14 Correct 39 ms 5328 KB Output is correct
15 Correct 35 ms 5460 KB Output is correct
16 Correct 34 ms 5464 KB Output is correct
17 Correct 1 ms 2484 KB Output is correct
18 Correct 1 ms 2580 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2392 KB Output is correct
22 Correct 44 ms 5576 KB Output is correct
23 Correct 40 ms 5320 KB Output is correct
24 Correct 33 ms 4700 KB Output is correct
25 Correct 46 ms 5716 KB Output is correct
26 Correct 36 ms 5460 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 2 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2392 KB Output is correct
34 Correct 51 ms 5884 KB Output is correct
35 Correct 52 ms 5724 KB Output is correct
36 Correct 54 ms 5976 KB Output is correct
37 Correct 57 ms 6484 KB Output is correct
38 Correct 41 ms 5968 KB Output is correct
39 Correct 24 ms 4700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 37 ms 4444 KB Output is correct
12 Correct 28 ms 3880 KB Output is correct
13 Correct 29 ms 4872 KB Output is correct
14 Correct 39 ms 5328 KB Output is correct
15 Correct 35 ms 5460 KB Output is correct
16 Correct 34 ms 5464 KB Output is correct
17 Correct 1 ms 2484 KB Output is correct
18 Correct 1 ms 2580 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2392 KB Output is correct
22 Correct 44 ms 5576 KB Output is correct
23 Correct 40 ms 5320 KB Output is correct
24 Correct 33 ms 4700 KB Output is correct
25 Correct 46 ms 5716 KB Output is correct
26 Correct 36 ms 5460 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 2 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2392 KB Output is correct
34 Correct 51 ms 5884 KB Output is correct
35 Correct 52 ms 5724 KB Output is correct
36 Correct 54 ms 5976 KB Output is correct
37 Correct 57 ms 6484 KB Output is correct
38 Correct 41 ms 5968 KB Output is correct
39 Correct 24 ms 4700 KB Output is correct
40 Correct 2 ms 2396 KB Output is correct
41 Correct 2 ms 2396 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 2 ms 2396 KB Output is correct
44 Correct 68 ms 6504 KB Output is correct
45 Correct 75 ms 6492 KB Output is correct
46 Correct 67 ms 6480 KB Output is correct
47 Correct 79 ms 6592 KB Output is correct
48 Correct 48 ms 6468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2548 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 1 ms 2392 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 2 ms 2652 KB Output is correct
28 Correct 2 ms 2652 KB Output is correct
29 Correct 3 ms 2652 KB Output is correct
30 Correct 2 ms 2396 KB Output is correct
31 Correct 3 ms 2392 KB Output is correct
32 Correct 2 ms 2396 KB Output is correct
33 Correct 2 ms 2652 KB Output is correct
34 Correct 2 ms 2652 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2528 KB Output is correct
38 Correct 2 ms 2620 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 0 ms 2396 KB Output is correct
42 Correct 1 ms 2392 KB Output is correct
43 Correct 0 ms 2396 KB Output is correct
44 Correct 0 ms 2396 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 1 ms 2396 KB Output is correct
48 Correct 0 ms 2396 KB Output is correct
49 Correct 1 ms 2396 KB Output is correct
50 Correct 37 ms 4444 KB Output is correct
51 Correct 28 ms 3880 KB Output is correct
52 Correct 29 ms 4872 KB Output is correct
53 Correct 39 ms 5328 KB Output is correct
54 Correct 35 ms 5460 KB Output is correct
55 Correct 34 ms 5464 KB Output is correct
56 Correct 1 ms 2484 KB Output is correct
57 Correct 1 ms 2580 KB Output is correct
58 Correct 0 ms 2396 KB Output is correct
59 Correct 1 ms 2396 KB Output is correct
60 Correct 1 ms 2392 KB Output is correct
61 Correct 44 ms 5576 KB Output is correct
62 Correct 40 ms 5320 KB Output is correct
63 Correct 33 ms 4700 KB Output is correct
64 Correct 46 ms 5716 KB Output is correct
65 Correct 36 ms 5460 KB Output is correct
66 Correct 1 ms 2396 KB Output is correct
67 Correct 1 ms 2396 KB Output is correct
68 Correct 1 ms 2396 KB Output is correct
69 Correct 1 ms 2396 KB Output is correct
70 Correct 2 ms 2396 KB Output is correct
71 Correct 1 ms 2396 KB Output is correct
72 Correct 1 ms 2392 KB Output is correct
73 Correct 51 ms 5884 KB Output is correct
74 Correct 52 ms 5724 KB Output is correct
75 Correct 54 ms 5976 KB Output is correct
76 Correct 57 ms 6484 KB Output is correct
77 Correct 41 ms 5968 KB Output is correct
78 Correct 24 ms 4700 KB Output is correct
79 Correct 2 ms 2396 KB Output is correct
80 Correct 2 ms 2396 KB Output is correct
81 Correct 1 ms 2396 KB Output is correct
82 Correct 2 ms 2396 KB Output is correct
83 Correct 68 ms 6504 KB Output is correct
84 Correct 75 ms 6492 KB Output is correct
85 Correct 67 ms 6480 KB Output is correct
86 Correct 79 ms 6592 KB Output is correct
87 Correct 48 ms 6468 KB Output is correct
88 Correct 86 ms 8504 KB Output is correct
89 Correct 89 ms 8272 KB Output is correct
90 Correct 82 ms 8272 KB Output is correct
91 Correct 87 ms 8276 KB Output is correct
92 Correct 80 ms 6996 KB Output is correct
93 Correct 82 ms 7248 KB Output is correct
94 Correct 83 ms 6992 KB Output is correct
95 Correct 58 ms 8272 KB Output is correct
96 Correct 90 ms 8420 KB Output is correct
97 Correct 48 ms 8528 KB Output is correct
98 Correct 46 ms 7012 KB Output is correct
99 Correct 51 ms 6992 KB Output is correct