답안 #861952

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
861952 2023-10-17T09:01:17 Z rog1gor Team Contest (JOI22_team) C++14
37 / 100
79 ms 24496 KB
#include <bits/stdc++.h>

using namespace std;

#define MAXN 150000

vector<pair<int, int>> con(MAXN), impl(MAXN), luck(MAXN);
vector<vector<int>> skills(MAXN);
vector<bool> unwanted(MAXN);

bool isAcceptable(int a, int b, int c){
    if(unwanted.at(a))
        return false;
    int score = 0;
    for(int i = 0; i < 3; ++i){
        if(skills.at(a).at(i) >= max(skills.at(b).at(i), skills.at(c).at(i)))
            ++score;
        if(score > 1)
            return false;
    }
    return true;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;

    for(int i = 0; i < n; ++i){
        cin >> con.at(i).first >> impl.at(i).first >> luck.at(i).first;
        con.at(i).second = i;
        impl.at(i).second = i;
        luck.at(i).second = i;
        skills.at(i) = {con.at(i).first, impl.at(i).first, luck.at(i).first};
    }
    //cerr << "jestem1";
    sort(con.rbegin(), con.rend());
    sort(impl.rbegin(), impl.rend());
    sort(luck.rbegin(), luck.rend());
    //cerr << "jestem2";

    int i = 0, j = 0, k = 0;
    bool good = true; 

    while(i < n || j < n || k < n){
        pair<int, int> conI = con.at(i);
        pair<int, int> implI = impl.at(j);
        pair<int, int> luckI = luck.at(k);
        good = true;
        if(!isAcceptable(conI.second, implI.second, luckI.second)){
            unwanted.at(conI.second) = true;
            ++i;
            good = false;
        }
        if(!isAcceptable(implI.second, conI.second, luckI.second)){
            unwanted.at(implI.second) = true;
            ++j;
            good = false;
        }
        if(!isAcceptable(luckI.second, implI.second, conI.second)){
            unwanted.at(luckI.second) = true;
            ++k;
            good = false;
        }
        if(good){
            cout << conI.first + implI.first + luckI.first;
            return 0;
        }
   }
   cout << -1;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 7516 KB Output is correct
2 Correct 9 ms 7516 KB Output is correct
3 Correct 10 ms 7312 KB Output is correct
4 Correct 9 ms 7536 KB Output is correct
5 Correct 10 ms 7516 KB Output is correct
6 Correct 11 ms 7516 KB Output is correct
7 Correct 10 ms 7516 KB Output is correct
8 Correct 10 ms 7512 KB Output is correct
9 Correct 9 ms 7516 KB Output is correct
10 Correct 9 ms 7532 KB Output is correct
11 Correct 9 ms 7516 KB Output is correct
12 Correct 10 ms 7272 KB Output is correct
13 Correct 9 ms 7516 KB Output is correct
14 Correct 9 ms 7508 KB Output is correct
15 Correct 10 ms 7516 KB Output is correct
16 Correct 10 ms 7516 KB Output is correct
17 Correct 10 ms 7536 KB Output is correct
18 Correct 10 ms 7516 KB Output is correct
19 Correct 10 ms 7536 KB Output is correct
20 Correct 10 ms 7516 KB Output is correct
21 Correct 10 ms 7540 KB Output is correct
22 Correct 10 ms 7516 KB Output is correct
23 Correct 13 ms 7540 KB Output is correct
24 Correct 10 ms 7516 KB Output is correct
25 Correct 9 ms 7516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 7516 KB Output is correct
2 Correct 9 ms 7516 KB Output is correct
3 Correct 10 ms 7312 KB Output is correct
4 Correct 9 ms 7536 KB Output is correct
5 Correct 10 ms 7516 KB Output is correct
6 Correct 11 ms 7516 KB Output is correct
7 Correct 10 ms 7516 KB Output is correct
8 Correct 10 ms 7512 KB Output is correct
9 Correct 9 ms 7516 KB Output is correct
10 Correct 9 ms 7532 KB Output is correct
11 Correct 9 ms 7516 KB Output is correct
12 Correct 10 ms 7272 KB Output is correct
13 Correct 9 ms 7516 KB Output is correct
14 Correct 9 ms 7508 KB Output is correct
15 Correct 10 ms 7516 KB Output is correct
16 Correct 10 ms 7516 KB Output is correct
17 Correct 10 ms 7536 KB Output is correct
18 Correct 10 ms 7516 KB Output is correct
19 Correct 10 ms 7536 KB Output is correct
20 Correct 10 ms 7516 KB Output is correct
21 Correct 10 ms 7540 KB Output is correct
22 Correct 10 ms 7516 KB Output is correct
23 Correct 13 ms 7540 KB Output is correct
24 Correct 10 ms 7516 KB Output is correct
25 Correct 9 ms 7516 KB Output is correct
26 Correct 11 ms 7516 KB Output is correct
27 Correct 12 ms 7516 KB Output is correct
28 Correct 11 ms 7516 KB Output is correct
29 Correct 13 ms 7516 KB Output is correct
30 Correct 11 ms 7516 KB Output is correct
31 Correct 12 ms 7660 KB Output is correct
32 Correct 13 ms 7516 KB Output is correct
33 Correct 11 ms 7516 KB Output is correct
34 Correct 12 ms 7772 KB Output is correct
35 Correct 10 ms 7516 KB Output is correct
36 Correct 10 ms 7544 KB Output is correct
37 Correct 15 ms 7516 KB Output is correct
38 Correct 10 ms 7660 KB Output is correct
39 Correct 10 ms 7516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 7516 KB Output is correct
2 Correct 9 ms 7516 KB Output is correct
3 Correct 9 ms 7516 KB Output is correct
4 Correct 10 ms 7516 KB Output is correct
5 Correct 9 ms 7516 KB Output is correct
6 Correct 9 ms 7512 KB Output is correct
7 Correct 14 ms 7528 KB Output is correct
8 Correct 9 ms 7516 KB Output is correct
9 Correct 9 ms 7516 KB Output is correct
10 Correct 9 ms 7516 KB Output is correct
11 Correct 63 ms 12200 KB Output is correct
12 Correct 49 ms 10588 KB Output is correct
13 Correct 45 ms 11376 KB Output is correct
14 Runtime error 79 ms 24496 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 7516 KB Output is correct
2 Correct 9 ms 7516 KB Output is correct
3 Correct 9 ms 7516 KB Output is correct
4 Correct 10 ms 7516 KB Output is correct
5 Correct 9 ms 7516 KB Output is correct
6 Correct 9 ms 7512 KB Output is correct
7 Correct 14 ms 7528 KB Output is correct
8 Correct 9 ms 7516 KB Output is correct
9 Correct 9 ms 7516 KB Output is correct
10 Correct 9 ms 7516 KB Output is correct
11 Correct 63 ms 12200 KB Output is correct
12 Correct 49 ms 10588 KB Output is correct
13 Correct 45 ms 11376 KB Output is correct
14 Runtime error 79 ms 24496 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 7516 KB Output is correct
2 Correct 9 ms 7516 KB Output is correct
3 Correct 9 ms 7516 KB Output is correct
4 Correct 10 ms 7516 KB Output is correct
5 Correct 9 ms 7516 KB Output is correct
6 Correct 9 ms 7512 KB Output is correct
7 Correct 14 ms 7528 KB Output is correct
8 Correct 9 ms 7516 KB Output is correct
9 Correct 9 ms 7516 KB Output is correct
10 Correct 9 ms 7516 KB Output is correct
11 Correct 63 ms 12200 KB Output is correct
12 Correct 49 ms 10588 KB Output is correct
13 Correct 45 ms 11376 KB Output is correct
14 Runtime error 79 ms 24496 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 7516 KB Output is correct
2 Correct 9 ms 7516 KB Output is correct
3 Correct 9 ms 7516 KB Output is correct
4 Correct 10 ms 7516 KB Output is correct
5 Correct 9 ms 7516 KB Output is correct
6 Correct 9 ms 7512 KB Output is correct
7 Correct 14 ms 7528 KB Output is correct
8 Correct 9 ms 7516 KB Output is correct
9 Correct 9 ms 7516 KB Output is correct
10 Correct 9 ms 7516 KB Output is correct
11 Correct 63 ms 12200 KB Output is correct
12 Correct 49 ms 10588 KB Output is correct
13 Correct 45 ms 11376 KB Output is correct
14 Runtime error 79 ms 24496 KB Execution killed with signal 6
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 7516 KB Output is correct
2 Correct 9 ms 7516 KB Output is correct
3 Correct 10 ms 7312 KB Output is correct
4 Correct 9 ms 7536 KB Output is correct
5 Correct 10 ms 7516 KB Output is correct
6 Correct 11 ms 7516 KB Output is correct
7 Correct 10 ms 7516 KB Output is correct
8 Correct 10 ms 7512 KB Output is correct
9 Correct 9 ms 7516 KB Output is correct
10 Correct 9 ms 7532 KB Output is correct
11 Correct 9 ms 7516 KB Output is correct
12 Correct 10 ms 7272 KB Output is correct
13 Correct 9 ms 7516 KB Output is correct
14 Correct 9 ms 7508 KB Output is correct
15 Correct 10 ms 7516 KB Output is correct
16 Correct 10 ms 7516 KB Output is correct
17 Correct 10 ms 7536 KB Output is correct
18 Correct 10 ms 7516 KB Output is correct
19 Correct 10 ms 7536 KB Output is correct
20 Correct 10 ms 7516 KB Output is correct
21 Correct 10 ms 7540 KB Output is correct
22 Correct 10 ms 7516 KB Output is correct
23 Correct 13 ms 7540 KB Output is correct
24 Correct 10 ms 7516 KB Output is correct
25 Correct 9 ms 7516 KB Output is correct
26 Correct 11 ms 7516 KB Output is correct
27 Correct 12 ms 7516 KB Output is correct
28 Correct 11 ms 7516 KB Output is correct
29 Correct 13 ms 7516 KB Output is correct
30 Correct 11 ms 7516 KB Output is correct
31 Correct 12 ms 7660 KB Output is correct
32 Correct 13 ms 7516 KB Output is correct
33 Correct 11 ms 7516 KB Output is correct
34 Correct 12 ms 7772 KB Output is correct
35 Correct 10 ms 7516 KB Output is correct
36 Correct 10 ms 7544 KB Output is correct
37 Correct 15 ms 7516 KB Output is correct
38 Correct 10 ms 7660 KB Output is correct
39 Correct 10 ms 7516 KB Output is correct
40 Correct 9 ms 7516 KB Output is correct
41 Correct 9 ms 7516 KB Output is correct
42 Correct 9 ms 7516 KB Output is correct
43 Correct 10 ms 7516 KB Output is correct
44 Correct 9 ms 7516 KB Output is correct
45 Correct 9 ms 7512 KB Output is correct
46 Correct 14 ms 7528 KB Output is correct
47 Correct 9 ms 7516 KB Output is correct
48 Correct 9 ms 7516 KB Output is correct
49 Correct 9 ms 7516 KB Output is correct
50 Correct 63 ms 12200 KB Output is correct
51 Correct 49 ms 10588 KB Output is correct
52 Correct 45 ms 11376 KB Output is correct
53 Runtime error 79 ms 24496 KB Execution killed with signal 6
54 Halted 0 ms 0 KB -