# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
222398 | dantoh000 | Checker (COCI19_checker) | C++14 | 256 ms | 22520 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;
int col[200005];
int adjmat[2005][2005];
int used[2005][2005];
vector<ii> adjlist[200005];
int st, n;
vector<ii> edg;
int f1, f2;
void addedge(int a, int b, int c){
if (st <= 2){
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 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');
col[i] = 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);
}
if (st <= 2){
for (auto x : edg){
for (auto y : edg){
if (x == y) continue;
int x1 = x.first, x2 = x.second, y1 = y.first, y2 = y.second;
int c1 = adjmat[x1][x2], c2 = adjmat[y1][y2];
int z1,z2;
if (x1 == y1){
z1 = x2, z2 = y2;
}
else if (x2 == y2){
z1 = x1, z2 = y1;
}
else continue;
int c3 = adjmat[z1][z2];
//printf("<%d %d>:%d, <%d %d>:%d, %d\n",x1,x2,c1,y1,y2,c2,c3);
if (c3 == 0) continue;
used[x1][x2] = used[x2][x1] = 1;
used[y1][y2] = used[y2][y1] = 1;
used[z1][z2] = used[z2][z1] = 1;
if (c1 == c2 || c3 != 6-c1-c2){
f2 = 0;
}
}
}
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
if (adjmat[i][j] != 0 && used[i][j] == 0) f1 = 0;
}
}
}
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... |