# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222480 | dantoh000 | Checker (COCI19_checker) | C++14 | 781 ms | 75932 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;
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 (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... |