# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
544523 |
2022-04-02T07:52:00 Z |
blue |
Team Contest (JOI22_team) |
C++17 |
|
891 ms |
44432 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
multiset<int> V[3];
set<pii> people[3];
int X[N][3];
for(int i = 0; i < N; i++)
{
for(int j = 0; j < 3; j++)
{
cin >> X[i][j];
V[j].insert(X[i][j]);
people[j].insert({X[i][j], i});
}
}
int elim = 0;
while(elim < N)
{
int fail = -1;
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
if(i == j) continue;
int p = people[i].rbegin()->second;
if(X[p][j] == *V[j].rbegin())
fail = p;
}
}
if(fail == -1)
{
int res = 0;
for(int k = 0; k < 3; k++)
res += *V[k].rbegin();
cout << res << '\n';
return 0;
}
else
{
for(int k = 0; k < 3; k++)
{
V[k].erase(V[k].find(X[fail][k]));
people[k].erase({X[fail][k], fail});
}
elim++;
}
}
cout << "-1\n";
}
# |
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 |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 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 |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 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 |
# |
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 |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 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 |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 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 |
8 ms |
1364 KB |
Output is correct |
27 |
Correct |
7 ms |
1408 KB |
Output is correct |
28 |
Correct |
10 ms |
1460 KB |
Output is correct |
29 |
Correct |
10 ms |
1448 KB |
Output is correct |
30 |
Correct |
6 ms |
980 KB |
Output is correct |
31 |
Correct |
6 ms |
1364 KB |
Output is correct |
32 |
Correct |
8 ms |
1488 KB |
Output is correct |
33 |
Correct |
6 ms |
1364 KB |
Output is correct |
34 |
Correct |
5 ms |
1396 KB |
Output is correct |
35 |
Correct |
1 ms |
468 KB |
Output is correct |
36 |
Correct |
2 ms |
468 KB |
Output is correct |
37 |
Correct |
5 ms |
1492 KB |
Output is correct |
38 |
Correct |
6 ms |
1492 KB |
Output is correct |
39 |
Correct |
2 ms |
852 KB |
Output is correct |
# |
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 |
1 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 |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
283 ms |
44432 KB |
Output is correct |
12 |
Correct |
257 ms |
29644 KB |
Output is correct |
13 |
Correct |
216 ms |
36540 KB |
Output is correct |
14 |
Correct |
431 ms |
44236 KB |
Output is correct |
15 |
Correct |
335 ms |
44332 KB |
Output is correct |
16 |
Correct |
307 ms |
44380 KB |
Output is correct |
# |
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 |
1 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 |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
283 ms |
44432 KB |
Output is correct |
12 |
Correct |
257 ms |
29644 KB |
Output is correct |
13 |
Correct |
216 ms |
36540 KB |
Output is correct |
14 |
Correct |
431 ms |
44236 KB |
Output is correct |
15 |
Correct |
335 ms |
44332 KB |
Output is correct |
16 |
Correct |
307 ms |
44380 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
852 KB |
Output is correct |
22 |
Correct |
353 ms |
44248 KB |
Output is correct |
23 |
Correct |
353 ms |
43256 KB |
Output is correct |
24 |
Correct |
343 ms |
32164 KB |
Output is correct |
25 |
Correct |
519 ms |
44344 KB |
Output is correct |
26 |
Correct |
368 ms |
44220 KB |
Output is correct |
# |
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 |
1 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 |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
283 ms |
44432 KB |
Output is correct |
12 |
Correct |
257 ms |
29644 KB |
Output is correct |
13 |
Correct |
216 ms |
36540 KB |
Output is correct |
14 |
Correct |
431 ms |
44236 KB |
Output is correct |
15 |
Correct |
335 ms |
44332 KB |
Output is correct |
16 |
Correct |
307 ms |
44380 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
852 KB |
Output is correct |
22 |
Correct |
353 ms |
44248 KB |
Output is correct |
23 |
Correct |
353 ms |
43256 KB |
Output is correct |
24 |
Correct |
343 ms |
32164 KB |
Output is correct |
25 |
Correct |
519 ms |
44344 KB |
Output is correct |
26 |
Correct |
368 ms |
44220 KB |
Output is correct |
27 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
31 |
Correct |
9 ms |
1492 KB |
Output is correct |
32 |
Correct |
1 ms |
468 KB |
Output is correct |
33 |
Correct |
2 ms |
468 KB |
Output is correct |
34 |
Correct |
390 ms |
42324 KB |
Output is correct |
35 |
Correct |
476 ms |
40180 KB |
Output is correct |
36 |
Correct |
607 ms |
44332 KB |
Output is correct |
37 |
Correct |
700 ms |
43804 KB |
Output is correct |
38 |
Correct |
457 ms |
43340 KB |
Output is correct |
39 |
Correct |
216 ms |
26700 KB |
Output is correct |
# |
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 |
1 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 |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
283 ms |
44432 KB |
Output is correct |
12 |
Correct |
257 ms |
29644 KB |
Output is correct |
13 |
Correct |
216 ms |
36540 KB |
Output is correct |
14 |
Correct |
431 ms |
44236 KB |
Output is correct |
15 |
Correct |
335 ms |
44332 KB |
Output is correct |
16 |
Correct |
307 ms |
44380 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
3 ms |
852 KB |
Output is correct |
22 |
Correct |
353 ms |
44248 KB |
Output is correct |
23 |
Correct |
353 ms |
43256 KB |
Output is correct |
24 |
Correct |
343 ms |
32164 KB |
Output is correct |
25 |
Correct |
519 ms |
44344 KB |
Output is correct |
26 |
Correct |
368 ms |
44220 KB |
Output is correct |
27 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
31 |
Correct |
9 ms |
1492 KB |
Output is correct |
32 |
Correct |
1 ms |
468 KB |
Output is correct |
33 |
Correct |
2 ms |
468 KB |
Output is correct |
34 |
Correct |
390 ms |
42324 KB |
Output is correct |
35 |
Correct |
476 ms |
40180 KB |
Output is correct |
36 |
Correct |
607 ms |
44332 KB |
Output is correct |
37 |
Correct |
700 ms |
43804 KB |
Output is correct |
38 |
Correct |
457 ms |
43340 KB |
Output is correct |
39 |
Correct |
216 ms |
26700 KB |
Output is correct |
40 |
Correct |
5 ms |
980 KB |
Output is correct |
41 |
Correct |
6 ms |
1364 KB |
Output is correct |
42 |
Correct |
4 ms |
1364 KB |
Output is correct |
43 |
Correct |
5 ms |
1364 KB |
Output is correct |
44 |
Correct |
623 ms |
44324 KB |
Output is correct |
45 |
Correct |
791 ms |
44324 KB |
Output is correct |
46 |
Correct |
774 ms |
44332 KB |
Output is correct |
47 |
Correct |
891 ms |
44364 KB |
Output is correct |
48 |
Correct |
583 ms |
44304 KB |
Output is correct |
# |
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 |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 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 |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 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 |
8 ms |
1364 KB |
Output is correct |
27 |
Correct |
7 ms |
1408 KB |
Output is correct |
28 |
Correct |
10 ms |
1460 KB |
Output is correct |
29 |
Correct |
10 ms |
1448 KB |
Output is correct |
30 |
Correct |
6 ms |
980 KB |
Output is correct |
31 |
Correct |
6 ms |
1364 KB |
Output is correct |
32 |
Correct |
8 ms |
1488 KB |
Output is correct |
33 |
Correct |
6 ms |
1364 KB |
Output is correct |
34 |
Correct |
5 ms |
1396 KB |
Output is correct |
35 |
Correct |
1 ms |
468 KB |
Output is correct |
36 |
Correct |
2 ms |
468 KB |
Output is correct |
37 |
Correct |
5 ms |
1492 KB |
Output is correct |
38 |
Correct |
6 ms |
1492 KB |
Output is correct |
39 |
Correct |
2 ms |
852 KB |
Output is correct |
40 |
Correct |
1 ms |
212 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
1 ms |
212 KB |
Output is correct |
43 |
Correct |
0 ms |
212 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Correct |
0 ms |
212 KB |
Output is correct |
46 |
Correct |
0 ms |
212 KB |
Output is correct |
47 |
Correct |
1 ms |
212 KB |
Output is correct |
48 |
Correct |
0 ms |
212 KB |
Output is correct |
49 |
Correct |
0 ms |
212 KB |
Output is correct |
50 |
Correct |
283 ms |
44432 KB |
Output is correct |
51 |
Correct |
257 ms |
29644 KB |
Output is correct |
52 |
Correct |
216 ms |
36540 KB |
Output is correct |
53 |
Correct |
431 ms |
44236 KB |
Output is correct |
54 |
Correct |
335 ms |
44332 KB |
Output is correct |
55 |
Correct |
307 ms |
44380 KB |
Output is correct |
56 |
Correct |
0 ms |
212 KB |
Output is correct |
57 |
Correct |
0 ms |
212 KB |
Output is correct |
58 |
Correct |
0 ms |
212 KB |
Output is correct |
59 |
Correct |
1 ms |
340 KB |
Output is correct |
60 |
Correct |
3 ms |
852 KB |
Output is correct |
61 |
Correct |
353 ms |
44248 KB |
Output is correct |
62 |
Correct |
353 ms |
43256 KB |
Output is correct |
63 |
Correct |
343 ms |
32164 KB |
Output is correct |
64 |
Correct |
519 ms |
44344 KB |
Output is correct |
65 |
Correct |
368 ms |
44220 KB |
Output is correct |
66 |
Correct |
1 ms |
340 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 |
340 KB |
Output is correct |
70 |
Correct |
9 ms |
1492 KB |
Output is correct |
71 |
Correct |
1 ms |
468 KB |
Output is correct |
72 |
Correct |
2 ms |
468 KB |
Output is correct |
73 |
Correct |
390 ms |
42324 KB |
Output is correct |
74 |
Correct |
476 ms |
40180 KB |
Output is correct |
75 |
Correct |
607 ms |
44332 KB |
Output is correct |
76 |
Correct |
700 ms |
43804 KB |
Output is correct |
77 |
Correct |
457 ms |
43340 KB |
Output is correct |
78 |
Correct |
216 ms |
26700 KB |
Output is correct |
79 |
Correct |
5 ms |
980 KB |
Output is correct |
80 |
Correct |
6 ms |
1364 KB |
Output is correct |
81 |
Correct |
4 ms |
1364 KB |
Output is correct |
82 |
Correct |
5 ms |
1364 KB |
Output is correct |
83 |
Correct |
623 ms |
44324 KB |
Output is correct |
84 |
Correct |
791 ms |
44324 KB |
Output is correct |
85 |
Correct |
774 ms |
44332 KB |
Output is correct |
86 |
Correct |
891 ms |
44364 KB |
Output is correct |
87 |
Correct |
583 ms |
44304 KB |
Output is correct |
88 |
Correct |
563 ms |
44328 KB |
Output is correct |
89 |
Correct |
623 ms |
44380 KB |
Output is correct |
90 |
Correct |
567 ms |
44324 KB |
Output is correct |
91 |
Correct |
666 ms |
44328 KB |
Output is correct |
92 |
Correct |
595 ms |
44252 KB |
Output is correct |
93 |
Correct |
703 ms |
44324 KB |
Output is correct |
94 |
Correct |
681 ms |
44328 KB |
Output is correct |
95 |
Correct |
437 ms |
44328 KB |
Output is correct |
96 |
Correct |
387 ms |
44368 KB |
Output is correct |
97 |
Correct |
324 ms |
44324 KB |
Output is correct |
98 |
Correct |
286 ms |
44240 KB |
Output is correct |
99 |
Correct |
295 ms |
44328 KB |
Output is correct |