# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222492 | 2020-04-13T08:21:23 Z | SomeoneUnknown | Checker (COCI19_checker) | C++14 | 214 ms | 16024 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()); } for(int i = 1; i <= n; i++){ for(int j = 0; j+1 < adjlist[i].size(); j++){ bool cused[4]; for(int k = 1; k < 4; k++) cused[k] = false; cused[adjlist[i][j].second] = true; if(cused[adjlist[i][j+1].second]){ printf("neispravna bojenje"); return 0; } cused[adjlist[i][j+1].second] = true; if(cused[adjlist[adjlist[i][j].first][0].second]){ printf("neispravna bojenje"); return 0; } } } printf("tocno"); } /* 1 7 1111111 6 3 2 3 5 2 7 2 2 7 3 2 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 201 ms | 15944 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 214 ms | 16024 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |