#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
checker.cpp: In function 'int main()':
checker.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&st);
~~~~~^~~~~~~~~~
checker.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
~~~~~^~~~~~~~~
checker.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf(" %c",&x);
~~~~~^~~~~~~~~~
checker.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d",&a,&b,&c);
~~~~~^~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
5760 KB |
Output is correct |
2 |
Correct |
8 ms |
5760 KB |
Output is correct |
3 |
Correct |
8 ms |
5760 KB |
Output is correct |
4 |
Correct |
9 ms |
5888 KB |
Output is correct |
5 |
Correct |
8 ms |
5888 KB |
Output is correct |
6 |
Correct |
8 ms |
5888 KB |
Output is correct |
7 |
Correct |
8 ms |
5888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
5760 KB |
Output is correct |
2 |
Correct |
8 ms |
5760 KB |
Output is correct |
3 |
Correct |
8 ms |
5760 KB |
Output is correct |
4 |
Correct |
9 ms |
5888 KB |
Output is correct |
5 |
Correct |
8 ms |
5888 KB |
Output is correct |
6 |
Correct |
8 ms |
5888 KB |
Output is correct |
7 |
Correct |
8 ms |
5888 KB |
Output is correct |
8 |
Correct |
146 ms |
22008 KB |
Output is correct |
9 |
Correct |
143 ms |
22292 KB |
Output is correct |
10 |
Correct |
152 ms |
22136 KB |
Output is correct |
11 |
Correct |
152 ms |
22520 KB |
Output is correct |
12 |
Correct |
147 ms |
22392 KB |
Output is correct |
13 |
Correct |
142 ms |
22192 KB |
Output is correct |
14 |
Correct |
149 ms |
22392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
225 ms |
21980 KB |
Output is correct |
2 |
Correct |
209 ms |
22108 KB |
Output is correct |
3 |
Incorrect |
221 ms |
22108 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
219 ms |
21980 KB |
Output is correct |
2 |
Correct |
212 ms |
22108 KB |
Output is correct |
3 |
Incorrect |
256 ms |
22084 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
5760 KB |
Output is correct |
2 |
Correct |
8 ms |
5760 KB |
Output is correct |
3 |
Correct |
8 ms |
5760 KB |
Output is correct |
4 |
Correct |
9 ms |
5888 KB |
Output is correct |
5 |
Correct |
8 ms |
5888 KB |
Output is correct |
6 |
Correct |
8 ms |
5888 KB |
Output is correct |
7 |
Correct |
8 ms |
5888 KB |
Output is correct |
8 |
Correct |
146 ms |
22008 KB |
Output is correct |
9 |
Correct |
143 ms |
22292 KB |
Output is correct |
10 |
Correct |
152 ms |
22136 KB |
Output is correct |
11 |
Correct |
152 ms |
22520 KB |
Output is correct |
12 |
Correct |
147 ms |
22392 KB |
Output is correct |
13 |
Correct |
142 ms |
22192 KB |
Output is correct |
14 |
Correct |
149 ms |
22392 KB |
Output is correct |
15 |
Correct |
225 ms |
21980 KB |
Output is correct |
16 |
Correct |
209 ms |
22108 KB |
Output is correct |
17 |
Incorrect |
221 ms |
22108 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |