# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
795705 | 2023-07-27T13:10:10 Z | vjudge1 | Team Contest (JOI22_team) | C++17 | 101 ms | 11400 KB |
// Author : حسن #include <bits/stdc++.h> using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define fi first #define se second #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" const int N = 3e5 + 9 , mod = 1e9 + 7; ll c[N] = {} , d[N] = {} , a[N] = {}, b[N] = {} , us[N] , dp[N] = {}; void solve(){ ll q , i , j , m , n , z , s = 0, f, l , k , x , y , mn = 1e18 , mx = 0; cin>>n; vector<pair<int,int>>v[3]; for(i = 1; i <= n; i++){ cin>>a[i]>>b[i]>>c[i]; v[0].pb({a[i] , i}); v[1].pb({b[i] , i}); v[2].pb({c[i] , i}); } ll r[4] = {}; r[0] = r[1] = r[2] = n - 1; sort(all(v[0])); sort(all(v[1])); sort(all(v[2])); while(r[0] >= 0 && r[1] >= 0 && r[2] >= 0){ //cout<<v[0][r[0]].se<<" "<< v[1][r[1]].se<<" "<< v[2][r[2]].se<<"\n"; if(b[v[0][r[0]].se] >= b[v[1][r[1]].se] || c[v[0][r[0]].se] >= c[v[2][r[2]].se]){ r[0]--; continue; } if(r[0] >= 0 && r[1] >= 0 && r[2] >= 0) if(a[v[1][r[1]].se] >= a[v[0][r[0]].se] || c[v[1][r[1]].se] >= c[v[2][r[2]].se]){ r[1]--; continue; } if(r[0] >= 0 && r[1] >= 0 && r[2] >= 0) if(a[v[2][r[2]].se] >= a[v[0][r[0]].se] || b[v[2][r[2]].se] >= b[v[1][r[1]].se]){ r[2]--; continue; } // cout<<v[0][r[0]].se<<" "<< v[1][r[1]].se<<" "<< v[2][r[2]].se<<"\n"; cout<<v[0][r[0]].fi + v[1][r[1]].fi + v[2][r[2]].fi; return; //s++; //if(s >= 100) //break; } //cout<<s<<" "; //if(r[0] >= 0 && r[1] >= 0 && r[2] >=0) // cout<<v[0][r[0]].fi + v[1][r[1]].fi + v[2][r[2]].fi; cout<<-1; } int main(){ TL; /* #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif */ int t = 1; //cin>>t; while(t--) { solve(); } } // Author : حسن
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 328 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 324 KB | Output is correct |
6 | Correct | 1 ms | 324 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 324 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 0 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 328 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 328 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 328 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 324 KB | Output is correct |
6 | Correct | 1 ms | 324 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 324 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 0 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 328 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 328 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 3 ms | 604 KB | Output is correct |
27 | Correct | 3 ms | 596 KB | Output is correct |
28 | Correct | 3 ms | 596 KB | Output is correct |
29 | Correct | 3 ms | 596 KB | Output is correct |
30 | Correct | 2 ms | 464 KB | Output is correct |
31 | Correct | 3 ms | 596 KB | Output is correct |
32 | Correct | 3 ms | 596 KB | Output is correct |
33 | Correct | 2 ms | 596 KB | Output is correct |
34 | Correct | 3 ms | 592 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 1 ms | 332 KB | Output is correct |
37 | Correct | 2 ms | 596 KB | Output is correct |
38 | Correct | 2 ms | 596 KB | Output is correct |
39 | Correct | 2 ms | 472 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 328 KB | Output is correct |
10 | Correct | 0 ms | 328 KB | Output is correct |
11 | Correct | 75 ms | 8548 KB | Output is correct |
12 | Correct | 38 ms | 5768 KB | Output is correct |
13 | Correct | 42 ms | 7020 KB | Output is correct |
14 | Correct | 68 ms | 8484 KB | Output is correct |
15 | Correct | 63 ms | 8488 KB | Output is correct |
16 | Correct | 49 ms | 8520 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 328 KB | Output is correct |
10 | Correct | 0 ms | 328 KB | Output is correct |
11 | Correct | 75 ms | 8548 KB | Output is correct |
12 | Correct | 38 ms | 5768 KB | Output is correct |
13 | Correct | 42 ms | 7020 KB | Output is correct |
14 | Correct | 68 ms | 8484 KB | Output is correct |
15 | Correct | 63 ms | 8488 KB | Output is correct |
16 | Correct | 49 ms | 8520 KB | Output is correct |
17 | Correct | 0 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 468 KB | Output is correct |
22 | Correct | 67 ms | 8776 KB | Output is correct |
23 | Correct | 65 ms | 8600 KB | Output is correct |
24 | Correct | 49 ms | 6324 KB | Output is correct |
25 | Correct | 84 ms | 8812 KB | Output is correct |
26 | Correct | 59 ms | 8604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 328 KB | Output is correct |
10 | Correct | 0 ms | 328 KB | Output is correct |
11 | Correct | 75 ms | 8548 KB | Output is correct |
12 | Correct | 38 ms | 5768 KB | Output is correct |
13 | Correct | 42 ms | 7020 KB | Output is correct |
14 | Correct | 68 ms | 8484 KB | Output is correct |
15 | Correct | 63 ms | 8488 KB | Output is correct |
16 | Correct | 49 ms | 8520 KB | Output is correct |
17 | Correct | 0 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 468 KB | Output is correct |
22 | Correct | 67 ms | 8776 KB | Output is correct |
23 | Correct | 65 ms | 8600 KB | Output is correct |
24 | Correct | 49 ms | 6324 KB | Output is correct |
25 | Correct | 84 ms | 8812 KB | Output is correct |
26 | Correct | 59 ms | 8604 KB | Output is correct |
27 | Correct | 1 ms | 332 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 324 KB | Output is correct |
31 | Correct | 2 ms | 596 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 67 ms | 9120 KB | Output is correct |
35 | Correct | 80 ms | 9096 KB | Output is correct |
36 | Correct | 78 ms | 9140 KB | Output is correct |
37 | Correct | 74 ms | 9232 KB | Output is correct |
38 | Correct | 63 ms | 9192 KB | Output is correct |
39 | Correct | 27 ms | 5692 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 328 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 328 KB | Output is correct |
10 | Correct | 0 ms | 328 KB | Output is correct |
11 | Correct | 75 ms | 8548 KB | Output is correct |
12 | Correct | 38 ms | 5768 KB | Output is correct |
13 | Correct | 42 ms | 7020 KB | Output is correct |
14 | Correct | 68 ms | 8484 KB | Output is correct |
15 | Correct | 63 ms | 8488 KB | Output is correct |
16 | Correct | 49 ms | 8520 KB | Output is correct |
17 | Correct | 0 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 468 KB | Output is correct |
22 | Correct | 67 ms | 8776 KB | Output is correct |
23 | Correct | 65 ms | 8600 KB | Output is correct |
24 | Correct | 49 ms | 6324 KB | Output is correct |
25 | Correct | 84 ms | 8812 KB | Output is correct |
26 | Correct | 59 ms | 8604 KB | Output is correct |
27 | Correct | 1 ms | 332 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 324 KB | Output is correct |
31 | Correct | 2 ms | 596 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 67 ms | 9120 KB | Output is correct |
35 | Correct | 80 ms | 9096 KB | Output is correct |
36 | Correct | 78 ms | 9140 KB | Output is correct |
37 | Correct | 74 ms | 9232 KB | Output is correct |
38 | Correct | 63 ms | 9192 KB | Output is correct |
39 | Correct | 27 ms | 5692 KB | Output is correct |
40 | Correct | 2 ms | 468 KB | Output is correct |
41 | Correct | 2 ms | 628 KB | Output is correct |
42 | Correct | 2 ms | 580 KB | Output is correct |
43 | Correct | 2 ms | 576 KB | Output is correct |
44 | Correct | 71 ms | 9628 KB | Output is correct |
45 | Correct | 80 ms | 9668 KB | Output is correct |
46 | Correct | 74 ms | 9680 KB | Output is correct |
47 | Correct | 77 ms | 9640 KB | Output is correct |
48 | Correct | 68 ms | 9572 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 328 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 324 KB | Output is correct |
6 | Correct | 1 ms | 324 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 324 KB | Output is correct |
10 | Correct | 0 ms | 340 KB | Output is correct |
11 | Correct | 0 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 328 KB | Output is correct |
19 | Correct | 1 ms | 332 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 328 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 3 ms | 604 KB | Output is correct |
27 | Correct | 3 ms | 596 KB | Output is correct |
28 | Correct | 3 ms | 596 KB | Output is correct |
29 | Correct | 3 ms | 596 KB | Output is correct |
30 | Correct | 2 ms | 464 KB | Output is correct |
31 | Correct | 3 ms | 596 KB | Output is correct |
32 | Correct | 3 ms | 596 KB | Output is correct |
33 | Correct | 2 ms | 596 KB | Output is correct |
34 | Correct | 3 ms | 592 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 1 ms | 332 KB | Output is correct |
37 | Correct | 2 ms | 596 KB | Output is correct |
38 | Correct | 2 ms | 596 KB | Output is correct |
39 | Correct | 2 ms | 472 KB | Output is correct |
40 | Correct | 1 ms | 340 KB | Output is correct |
41 | Correct | 1 ms | 340 KB | Output is correct |
42 | Correct | 1 ms | 340 KB | Output is correct |
43 | Correct | 1 ms | 328 KB | Output is correct |
44 | Correct | 1 ms | 340 KB | Output is correct |
45 | Correct | 1 ms | 340 KB | Output is correct |
46 | Correct | 1 ms | 332 KB | Output is correct |
47 | Correct | 1 ms | 340 KB | Output is correct |
48 | Correct | 1 ms | 328 KB | Output is correct |
49 | Correct | 0 ms | 328 KB | Output is correct |
50 | Correct | 75 ms | 8548 KB | Output is correct |
51 | Correct | 38 ms | 5768 KB | Output is correct |
52 | Correct | 42 ms | 7020 KB | Output is correct |
53 | Correct | 68 ms | 8484 KB | Output is correct |
54 | Correct | 63 ms | 8488 KB | Output is correct |
55 | Correct | 49 ms | 8520 KB | Output is correct |
56 | Correct | 0 ms | 340 KB | Output is correct |
57 | Correct | 0 ms | 340 KB | Output is correct |
58 | Correct | 1 ms | 340 KB | Output is correct |
59 | Correct | 1 ms | 340 KB | Output is correct |
60 | Correct | 1 ms | 468 KB | Output is correct |
61 | Correct | 67 ms | 8776 KB | Output is correct |
62 | Correct | 65 ms | 8600 KB | Output is correct |
63 | Correct | 49 ms | 6324 KB | Output is correct |
64 | Correct | 84 ms | 8812 KB | Output is correct |
65 | Correct | 59 ms | 8604 KB | Output is correct |
66 | Correct | 1 ms | 332 KB | Output is correct |
67 | Correct | 1 ms | 340 KB | Output is correct |
68 | Correct | 1 ms | 340 KB | Output is correct |
69 | Correct | 1 ms | 324 KB | Output is correct |
70 | Correct | 2 ms | 596 KB | Output is correct |
71 | Correct | 1 ms | 340 KB | Output is correct |
72 | Correct | 1 ms | 340 KB | Output is correct |
73 | Correct | 67 ms | 9120 KB | Output is correct |
74 | Correct | 80 ms | 9096 KB | Output is correct |
75 | Correct | 78 ms | 9140 KB | Output is correct |
76 | Correct | 74 ms | 9232 KB | Output is correct |
77 | Correct | 63 ms | 9192 KB | Output is correct |
78 | Correct | 27 ms | 5692 KB | Output is correct |
79 | Correct | 2 ms | 468 KB | Output is correct |
80 | Correct | 2 ms | 628 KB | Output is correct |
81 | Correct | 2 ms | 580 KB | Output is correct |
82 | Correct | 2 ms | 576 KB | Output is correct |
83 | Correct | 71 ms | 9628 KB | Output is correct |
84 | Correct | 80 ms | 9668 KB | Output is correct |
85 | Correct | 74 ms | 9680 KB | Output is correct |
86 | Correct | 77 ms | 9640 KB | Output is correct |
87 | Correct | 68 ms | 9572 KB | Output is correct |
88 | Correct | 70 ms | 11340 KB | Output is correct |
89 | Correct | 101 ms | 11360 KB | Output is correct |
90 | Correct | 81 ms | 11312 KB | Output is correct |
91 | Correct | 83 ms | 11328 KB | Output is correct |
92 | Correct | 73 ms | 9904 KB | Output is correct |
93 | Correct | 90 ms | 10308 KB | Output is correct |
94 | Correct | 73 ms | 10112 KB | Output is correct |
95 | Correct | 70 ms | 11232 KB | Output is correct |
96 | Correct | 91 ms | 11364 KB | Output is correct |
97 | Correct | 49 ms | 11400 KB | Output is correct |
98 | Correct | 39 ms | 10032 KB | Output is correct |
99 | Correct | 70 ms | 10012 KB | Output is correct |