# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222483 | SomeoneUnknown | Checker (COCI19_checker) | C++14 | 204 ms | 16408 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |