Submission #222480

# Submission time Handle Problem Language Result Execution time Memory
222480 2020-04-13T08:11:25 Z dantoh000 Checker (COCI19_checker) C++14
110 / 110
781 ms 75932 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
unordered_map<int, unordered_map<int, int> > adjmat;
vector<ii> adjlist[200005];
int st, n;
vector<ii> edg;
int f1, f2;
void addedge(int a, int b, int c){
    adjmat[a][b] = adjmat[b][a] = c;
    adjlist[a].push_back({b,c});
    adjlist[b].push_back({a,c});
    if (a > b) swap(a,b);
    edg.push_back({a,b});
}
int cur;
bool cmp(ii a, ii b){
    return (n+a.first-cur)%n < (n+b.first-cur)%n;
}
int main(){
    scanf("%d",&st);
    scanf("%d",&n);
    f1 = f2 = 1;
    for (int i = 1; i <= n; i++){
        char x;
        scanf(" %c",&x);
        addedge(i,i%n+1,x-'0');
    }
    for (int i = 0; i < n-3; i++){
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        addedge(a,b,c);
    }
    for (int i = 1; i <= n; i++){
        cur = i;
        sort(adjlist[i].begin(),adjlist[i].end(),cmp);
        for (int j = 0; j < (int)adjlist[i].size()-1; j++){
            ii cur = adjlist[i][j];
            ii nx = adjlist[i][j+1];
            if (cur.second == nx.second) f2 = 0;
            int z1 = cur.first, z2 = nx.first;
            //printf("%d -> %d -> %d\n",i,z1,z2);
            if (adjmat[z1][z2] == 0) f1 = 0;
            else{
                if (cur.second + nx.second + adjmat[z1][z2] != 6) f2 = 0;
            }
        }
        for (auto x : adjlist[i]){
            //printf("<%d %d>:%d\n",i,x.first,x.second);
        }
    }
    if (f1 == 0) printf("neispravna triangulacija");
    else if (f2 == 0) printf("neispravno bojenje");
    else printf("tocno");


}

Compilation message

checker.cpp: In function 'int main()':
checker.cpp:48:19: warning: variable 'x' set but not used [-Wunused-but-set-variable]
         for (auto x : adjlist[i]){
                   ^
checker.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&st);
     ~~~~~^~~~~~~~~~
checker.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
checker.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %c",&x);
         ~~~~~^~~~~~~~~~
checker.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d",&a,&b,&c);
         ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 5120 KB Output is correct
4 Correct 7 ms 4992 KB Output is correct
5 Correct 8 ms 5120 KB Output is correct
6 Correct 7 ms 4992 KB Output is correct
7 Correct 7 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 5120 KB Output is correct
4 Correct 7 ms 4992 KB Output is correct
5 Correct 8 ms 5120 KB Output is correct
6 Correct 7 ms 4992 KB Output is correct
7 Correct 7 ms 4992 KB Output is correct
8 Correct 10 ms 5760 KB Output is correct
9 Correct 11 ms 5760 KB Output is correct
10 Correct 11 ms 5760 KB Output is correct
11 Correct 11 ms 5760 KB Output is correct
12 Correct 11 ms 5760 KB Output is correct
13 Correct 11 ms 5760 KB Output is correct
14 Correct 10 ms 5760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 690 ms 74472 KB Output is correct
2 Correct 687 ms 74528 KB Output is correct
3 Correct 677 ms 74400 KB Output is correct
4 Correct 664 ms 74396 KB Output is correct
5 Correct 689 ms 74912 KB Output is correct
6 Correct 776 ms 75768 KB Output is correct
7 Correct 760 ms 75932 KB Output is correct
8 Correct 764 ms 75804 KB Output is correct
9 Correct 749 ms 75804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 682 ms 74408 KB Output is correct
2 Correct 677 ms 74524 KB Output is correct
3 Correct 687 ms 74360 KB Output is correct
4 Correct 693 ms 74396 KB Output is correct
5 Correct 668 ms 74396 KB Output is correct
6 Correct 745 ms 75804 KB Output is correct
7 Correct 766 ms 75740 KB Output is correct
8 Correct 780 ms 75812 KB Output is correct
9 Correct 767 ms 75928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 5120 KB Output is correct
4 Correct 7 ms 4992 KB Output is correct
5 Correct 8 ms 5120 KB Output is correct
6 Correct 7 ms 4992 KB Output is correct
7 Correct 7 ms 4992 KB Output is correct
8 Correct 10 ms 5760 KB Output is correct
9 Correct 11 ms 5760 KB Output is correct
10 Correct 11 ms 5760 KB Output is correct
11 Correct 11 ms 5760 KB Output is correct
12 Correct 11 ms 5760 KB Output is correct
13 Correct 11 ms 5760 KB Output is correct
14 Correct 10 ms 5760 KB Output is correct
15 Correct 690 ms 74472 KB Output is correct
16 Correct 687 ms 74528 KB Output is correct
17 Correct 677 ms 74400 KB Output is correct
18 Correct 664 ms 74396 KB Output is correct
19 Correct 689 ms 74912 KB Output is correct
20 Correct 776 ms 75768 KB Output is correct
21 Correct 760 ms 75932 KB Output is correct
22 Correct 764 ms 75804 KB Output is correct
23 Correct 749 ms 75804 KB Output is correct
24 Correct 682 ms 74408 KB Output is correct
25 Correct 677 ms 74524 KB Output is correct
26 Correct 687 ms 74360 KB Output is correct
27 Correct 693 ms 74396 KB Output is correct
28 Correct 668 ms 74396 KB Output is correct
29 Correct 745 ms 75804 KB Output is correct
30 Correct 766 ms 75740 KB Output is correct
31 Correct 780 ms 75812 KB Output is correct
32 Correct 767 ms 75928 KB Output is correct
33 Correct 685 ms 74444 KB Output is correct
34 Correct 685 ms 74648 KB Output is correct
35 Correct 671 ms 74396 KB Output is correct
36 Correct 688 ms 74396 KB Output is correct
37 Correct 674 ms 74508 KB Output is correct
38 Correct 679 ms 74528 KB Output is correct
39 Correct 667 ms 74400 KB Output is correct
40 Correct 767 ms 75812 KB Output is correct
41 Correct 752 ms 75800 KB Output is correct
42 Correct 741 ms 75804 KB Output is correct
43 Correct 781 ms 75724 KB Output is correct