답안 #711747

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711747 2023-03-17T12:08:05 Z scottchou Checker (COCI19_checker) C++17
110 / 110
104 ms 16916 KB
#include<bits/stdc++.h>
using namespace std;
int  const N = 2e5 + 5;
vector<pair<int, int> > have[N];
int instk[N];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, t;
    cin >> t;
    cin >> n;
    string s;
    cin >> s;
    int u, v, c;
    for(int i = 0; i < n - 3; i++){
        cin >> u >> v >> c;
        if(u > v)
            swap(u, v);
        have[u].push_back({v, c});
    }
    vector<int> stk;
    for(int i = 1; i <= n; i++){
        while(instk[i]){
            if(stk.back() != i){
                cout << "neispravna triangulacija\n";
                return 0;
            }else{
                stk.pop_back();
                instk[i]--;
            }
        }
        sort(have[i].begin(), have[i].end());
        for(int j = (int)have[i].size() - 1; j >= 0; j--){
            stk.push_back(have[i][j].first);
            instk[have[i][j].first]++;
        }
    }
    vector<pair<int,int> > st;
    vector<int> stk2;
    for(int i = 1; i <= n; i++){
        while(instk[i]){
            if(st.back().second == stk2.back() || stk2.back() == stk2[stk2.size() - 2] || stk2[stk2.size() - 2] == st.back().second){
                cout << "neispravno bojenje\n";
                return 0;
            }
            stk2.pop_back();
            stk2.pop_back();
            stk2.push_back(st.back().second);
            st.pop_back();
            instk[i]--;
        }
        for(int j = (int)have[i].size() - 1; j >= 0; j--){
            st.push_back(have[i][j]);
            instk[have[i][j].first]++;
        }
        if(i == n){
            if(s[i - 1] - '0' == stk2.back() || stk2.back() == stk2[stk2.size() - 2] || stk2[stk2.size() - 2] == s[i - 1] - '0'){
                cout << "neispravno bojenje\n";
                return 0;
            }
        }
        stk2.push_back(s[i - 1] - '0');
    }
    cout << "tocno\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 4 ms 4952 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 4 ms 4952 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 3 ms 5076 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 3 ms 5076 KB Output is correct
12 Correct 3 ms 5064 KB Output is correct
13 Correct 3 ms 5040 KB Output is correct
14 Correct 3 ms 5032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 100 ms 11516 KB Output is correct
2 Correct 99 ms 11008 KB Output is correct
3 Correct 72 ms 10236 KB Output is correct
4 Correct 66 ms 9988 KB Output is correct
5 Correct 71 ms 9968 KB Output is correct
6 Correct 91 ms 14720 KB Output is correct
7 Correct 69 ms 11616 KB Output is correct
8 Correct 59 ms 10576 KB Output is correct
9 Correct 54 ms 9420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 11608 KB Output is correct
2 Correct 92 ms 10804 KB Output is correct
3 Correct 83 ms 10856 KB Output is correct
4 Correct 79 ms 12804 KB Output is correct
5 Correct 80 ms 12832 KB Output is correct
6 Correct 87 ms 16916 KB Output is correct
7 Correct 76 ms 15520 KB Output is correct
8 Correct 92 ms 16212 KB Output is correct
9 Correct 72 ms 13624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 4 ms 4952 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 3 ms 5076 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 3 ms 5076 KB Output is correct
12 Correct 3 ms 5064 KB Output is correct
13 Correct 3 ms 5040 KB Output is correct
14 Correct 3 ms 5032 KB Output is correct
15 Correct 100 ms 11516 KB Output is correct
16 Correct 99 ms 11008 KB Output is correct
17 Correct 72 ms 10236 KB Output is correct
18 Correct 66 ms 9988 KB Output is correct
19 Correct 71 ms 9968 KB Output is correct
20 Correct 91 ms 14720 KB Output is correct
21 Correct 69 ms 11616 KB Output is correct
22 Correct 59 ms 10576 KB Output is correct
23 Correct 54 ms 9420 KB Output is correct
24 Correct 88 ms 11608 KB Output is correct
25 Correct 92 ms 10804 KB Output is correct
26 Correct 83 ms 10856 KB Output is correct
27 Correct 79 ms 12804 KB Output is correct
28 Correct 80 ms 12832 KB Output is correct
29 Correct 87 ms 16916 KB Output is correct
30 Correct 76 ms 15520 KB Output is correct
31 Correct 92 ms 16212 KB Output is correct
32 Correct 72 ms 13624 KB Output is correct
33 Correct 82 ms 12848 KB Output is correct
34 Correct 102 ms 12824 KB Output is correct
35 Correct 73 ms 12184 KB Output is correct
36 Correct 75 ms 11944 KB Output is correct
37 Correct 83 ms 12812 KB Output is correct
38 Correct 71 ms 12772 KB Output is correct
39 Correct 73 ms 12748 KB Output is correct
40 Correct 104 ms 16544 KB Output is correct
41 Correct 82 ms 15808 KB Output is correct
42 Correct 62 ms 13024 KB Output is correct
43 Correct 84 ms 16144 KB Output is correct