Submission #222414

# Submission time Handle Problem Language Result Execution time Memory
222414 2020-04-13T06:58:54 Z cheeheng Checker (COCI19_checker) C++14
29 / 110
241 ms 83192 KB
#include <bits/stdc++.h>
using namespace std;

char colour[200005];

int deg[200005];

int X[200005];
int Y[200005];

vector<int> AdjList[200005];

int AdjMat[3005][3005];

int main(){
    int ST;
    scanf("%d", &ST);

    int N;
    scanf("%d", &N);

    scanf(" %s", colour);

    memset(AdjMat, 0, sizeof(AdjMat));
    for(int i = 0; i < N; i ++){
        AdjList[i+1].push_back( ((i+1)%N)+1 );

        //printf("%d %d\n", i+1, ((i+1)%N)+1);

        AdjList[((i+1)%N)+1].push_back( i+1 );

        AdjMat[((i+1)%N)+1][i+1] = colour[i]-'0';
        AdjMat[i+1][((i+1)%N)+1] = colour[i]-'0';
    }

    for(int i = 1; i <= N; i ++){
        for(int j: AdjList[i]){
            //printf("%d %d\n", i, j);
        }
    }

    memset(deg, 0, sizeof(deg));
    for(int i = 0; i < N-3; i ++){
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);

        X[i] = a;
        Y[i] = b;
        AdjMat[a][b] = AdjMat[b][a] = c;
        AdjList[a].push_back(b);
        AdjList[b].push_back(a);
    }

    for(int i = 0; i < N-3; i ++){
        for(int j = 0; j < N-3; j ++){
            if(i == j){continue;}
            if(X[i] < X[j] && X[j] < Y[i] && Y[i] < Y[j]){
                printf("neispravna triangulacija");
                return 0;
            }

            if(X[j] < Y[i] && Y[i] < Y[j] && Y[j] < X[i]){
                printf("neispravna triangulacija");
                return 0;
            }

            if(Y[i] < Y[j] && Y[j] < X[i] && X[i] < X[j]){
                printf("neispravna triangulacija");
                return 0;
            }

            if(Y[j] < X[i] && X[i] < X[j] && X[j] < Y[i]){
                printf("neispravna triangulacija");
                return 0;
            }
        }
    }

    for(int i = 1; i <= N; i ++){
        for(int j: AdjList[i]){
            //printf("AdjList: %d %d\n", i, j);
            for(int k: AdjList[j]){
                if(i == k){continue;}
                //printf("324: %d %d %d\n", i, j, k);
                if(AdjMat[i][k]){
                    if( ((1<<AdjMat[i][k]) + (1<<AdjMat[i][j]) + (1<<AdjMat[j][k])) != 14){
                        //printf("%d%d%d\n", AdjMat[i][k], AdjMat[i][j], AdjMat[j][k]);
                        printf("neispravno bojenje");
                        return 0;
                    }
                }
            }
        }
    }

    printf("tocno");
    return 0;
}

Compilation message

checker.cpp: In function 'int main()':
checker.cpp:37:17: warning: unused variable 'j' [-Wunused-variable]
         for(int j: AdjList[i]){
                 ^
checker.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &ST);
     ~~~~~^~~~~~~~~~~
checker.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
checker.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf(" %s", colour);
     ~~~~~^~~~~~~~~~~~~~~
checker.cpp:45: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 27 ms 41088 KB Output is correct
2 Correct 28 ms 41216 KB Output is correct
3 Correct 27 ms 41216 KB Output is correct
4 Correct 27 ms 41216 KB Output is correct
5 Correct 31 ms 41208 KB Output is correct
6 Correct 27 ms 41216 KB Output is correct
7 Correct 27 ms 41216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 41088 KB Output is correct
2 Correct 28 ms 41216 KB Output is correct
3 Correct 27 ms 41216 KB Output is correct
4 Correct 27 ms 41216 KB Output is correct
5 Correct 31 ms 41208 KB Output is correct
6 Correct 27 ms 41216 KB Output is correct
7 Correct 27 ms 41216 KB Output is correct
8 Correct 50 ms 41216 KB Output is correct
9 Correct 52 ms 41216 KB Output is correct
10 Correct 30 ms 41216 KB Output is correct
11 Correct 29 ms 41216 KB Output is correct
12 Correct 50 ms 41216 KB Output is correct
13 Correct 50 ms 41336 KB Output is correct
14 Correct 50 ms 41216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 80 ms 83192 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 241 ms 82936 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 41088 KB Output is correct
2 Correct 28 ms 41216 KB Output is correct
3 Correct 27 ms 41216 KB Output is correct
4 Correct 27 ms 41216 KB Output is correct
5 Correct 31 ms 41208 KB Output is correct
6 Correct 27 ms 41216 KB Output is correct
7 Correct 27 ms 41216 KB Output is correct
8 Correct 50 ms 41216 KB Output is correct
9 Correct 52 ms 41216 KB Output is correct
10 Correct 30 ms 41216 KB Output is correct
11 Correct 29 ms 41216 KB Output is correct
12 Correct 50 ms 41216 KB Output is correct
13 Correct 50 ms 41336 KB Output is correct
14 Correct 50 ms 41216 KB Output is correct
15 Runtime error 80 ms 83192 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Halted 0 ms 0 KB -