Submission #222483

# Submission time Handle Problem Language Result Execution time Memory
222483 2020-04-13T08:13:37 Z SomeoneUnknown Checker (COCI19_checker) C++14
23 / 110
204 ms 16408 KB
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> ii;
typedef pair<int, ii> iii; //from, to, col

ii mii(int a, int b){
    return make_pair(a,b);
}

iii miii(int a, int b, int c){
    return make_pair(a, mii(b,c));
}

vector<vector<ii> > adjlist;

int gcoloroflink(int f, int t){
    if(f >= t){
        exit(75);
    }
    int lo = -1;
    int hi = adjlist[f].size();
    while(hi-lo > 1){
        int mid = (lo+hi)/2;
        if(t == adjlist[f][mid].first){
            return adjlist[f][mid].second;
        }else if(t < adjlist[f][mid].first){
            hi = mid;
        }else{
            lo = mid;
        }
    }
    exit(76);
}

int main(){
    //printf("tocno");
    //return 0;
    int n;
    scanf("%d", &n);
    scanf("%d", &n);
    char c;
    scanf("%c", &c);
    int col;
    vector<ii> x;
    adjlist.push_back(x);
    for(int i = 1; i <= n; i++){
        vector<ii> x1;
        adjlist.push_back(x1);
        scanf("%c",&c);
        col = (int)(c-'0');
        if(i == n){
            adjlist[1].push_back(mii(n,col));
        }else{
            adjlist[i].push_back(mii(i+1,col));
        }
    }
    iii edges[n-3];
    for(int i = 0; i < n-3; i++){
        int f, t;
        scanf("%d %d %d", &f, &t, &col);
        if(t < f){
            int ph = f;
            f = t;
            t = ph;
        }
        edges[i] = miii(f,-t,col);
        adjlist[f].push_back(mii(t,col));
    }
    sort(edges,edges+n-3);
    stack<int> dne;
    dne.push(n+1);
    int prev = 0;
    for(int i = 0; i < n-3; i++){
        int to = -edges[i].second.first;
        if(to == dne.top() && prev == edges[i].first){
            printf("neispravna triangulacija");
            return 0;
        }
        while(dne.top() <= edges[i].first){
            dne.pop();
        }
        //printf("%d %d\n", to, dne.top());
        if(dne.top() < to){
            printf("neispravna triangulacija");
            return 0;
        }
        dne.push(to);
        prev = edges[i].first;
    }
    for(int i = 1; i <= n; i++){
        sort(adjlist[i].begin(), adjlist[i].end());
    }
    printf("tocno");
}
/*
1 7
1111111
6 3 2
3 5 2
7 2 2
7 3 2
*/

Compilation message

checker.cpp: In function 'int main()':
checker.cpp:40:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
checker.cpp:41:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
checker.cpp:43:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%c", &c);
     ~~~~~^~~~~~~~~~
checker.cpp:50:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%c",&c);
         ~~~~~^~~~~~~~~
checker.cpp:61:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d", &f, &t, &col);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Incorrect 5 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Incorrect 5 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 204 ms 16024 KB Output is correct
2 Correct 203 ms 16000 KB Output is correct
3 Correct 182 ms 15896 KB Output is correct
4 Correct 179 ms 15896 KB Output is correct
5 Correct 192 ms 16024 KB Output is correct
6 Correct 183 ms 13980 KB Output is correct
7 Correct 158 ms 16408 KB Output is correct
8 Correct 156 ms 15388 KB Output is correct
9 Correct 142 ms 15388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 198 ms 15896 KB Output is correct
2 Correct 193 ms 15940 KB Output is correct
3 Incorrect 200 ms 15988 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Incorrect 5 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -