# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
292314 | kingfran1907 | Checker (COCI19_checker) | C++14 | 238 ms | 10848 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>
#define X first
#define Y second
using namespace std;
typedef long long llint;
const int maxn = 2e5+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;
int t;
int n;
int c[maxn];
vector< pair< pair<int, int>, int > > v;
bool bio[maxn];
int nx[maxn];
bool cmp(pair< pair<int, int>, int> a, pair< pair<int, int>, int> b) {
return ((a.X.Y - a.X.X + n) % n) < ((b.X.Y - b.X.X + n) % n);
}
int main() {
scanf("%d%d", &t, &n);
memset(bio, false, sizeof bio);
for (int i = 0; i < n; i++) {
char x;
scanf(" %c", &x);
c[i] = x - '1';
nx[i] = (i + 1) % n;
}
for (int i = 3; i < n; i++) {
int a, b, c;
scanf("%d%d%d", &a, &b, &c); a--, b--, c--;
v.push_back(make_pair(make_pair(a, b), c));
v.push_back(make_pair(make_pair(b, a), c));
}
sort(v.begin(), v.end(), cmp);
bool flag1 = true;
bool flag2 = true;
for (int i = 0; i < n - 3; i++) {
int x = v[i].X.X;
int y = v[i].X.Y;
int cl = v[i].Y;
//printf("debug: %d %d -> %d %d %d\n", x + 1, y + 1, c[x], c[nx[x]], cl);
if (bio[x] || bio[y]) {
flag1 = false;
break;
}
if (nx[nx[x]] != y) {
flag1 = false;
break;
}
bio[nx[x]] = true;
if (!(c[x] + c[nx[x]] + cl == 3 && min({c[x], c[nx[x]], cl}) == 0)) flag2 = false;
c[x] = cl;
nx[x] = y;
}
if (!flag1) printf("neispravna triangulacija\n");
else if (!flag2) printf("neispravno bojenje\n");
else printf("tocno\n");
return 0;
}
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... |