Submission #712037

# Submission time Handle Problem Language Result Execution time Memory
712037 2023-03-18T02:16:51 Z willychan Checker (COCI19_checker) C++14
110 / 110
80 ms 6232 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds


struct edge{
	int from;
	int to;
	int c;
};
vector<pair<int,int>> rt;
vector<pair<int,int>> lt;
int n;
bool cmp(const edge &a,const edge &b){
	int disa = abs(a.from-a.to);
	int disb = abs(b.from-b.to);
	disa = min(disa,n-disa);
	disb= min(disb,n-disb);
	return disa<disb;
}


int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int t;cin>>t;
	cin>>n;
	rt.resize(n);
	lt.resize(n);
	vector<edge> es(n-3);
	string s;cin>>s;
	for(int i=0;i<n;i++){
		rt[i] =  {(i+1)%n,s[i]-'0'};
		lt[(i+1)%n] = {i,s[i]-'0'};
	}
	for(int i=0;i<n-3;i++){
		cin>>es[i].from>>es[i].to>>es[i].c;
		es[i].from--;
		es[i].to--;
	}
	sort(es.begin(),es.end(),cmp);
	bool par = 1;
	for(int i=0;i<n-3;i++){
		int a = es[i].from;
		int b = es[i].to;
		int c = es[i].c;
		if(rt[b].first==lt[a].first){
			swap(a,b);
		}
		if(rt[a].first==lt[b].first){
			if(c==rt[a].second || rt[a].second==lt[b].second || lt[b].second==c) par=0;	
			int k = rt[a].first;
			rt[lt[k].first] = {rt[k].first,c};
			lt[rt[k].first] = {lt[k].first,c};
			lt[k] = {k,0};
			rt[k] = {k,0};
		}else{
			cout<<"neispravna triangulacija\n";
			return 0;
		}
	}
	if(par){
		cout<<"tocno\n";
	}else{
		cout<<"neispravno bojenje\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 6112 KB Output is correct
2 Correct 74 ms 6124 KB Output is correct
3 Correct 67 ms 6112 KB Output is correct
4 Correct 80 ms 6112 KB Output is correct
5 Correct 65 ms 6112 KB Output is correct
6 Correct 74 ms 6104 KB Output is correct
7 Correct 75 ms 6112 KB Output is correct
8 Correct 77 ms 6112 KB Output is correct
9 Correct 74 ms 6112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 6120 KB Output is correct
2 Correct 69 ms 6112 KB Output is correct
3 Correct 66 ms 6116 KB Output is correct
4 Correct 71 ms 6124 KB Output is correct
5 Correct 77 ms 6112 KB Output is correct
6 Correct 72 ms 6112 KB Output is correct
7 Correct 76 ms 6112 KB Output is correct
8 Correct 79 ms 6232 KB Output is correct
9 Correct 72 ms 6108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 372 KB Output is correct
15 Correct 69 ms 6112 KB Output is correct
16 Correct 74 ms 6124 KB Output is correct
17 Correct 67 ms 6112 KB Output is correct
18 Correct 80 ms 6112 KB Output is correct
19 Correct 65 ms 6112 KB Output is correct
20 Correct 74 ms 6104 KB Output is correct
21 Correct 75 ms 6112 KB Output is correct
22 Correct 77 ms 6112 KB Output is correct
23 Correct 74 ms 6112 KB Output is correct
24 Correct 73 ms 6120 KB Output is correct
25 Correct 69 ms 6112 KB Output is correct
26 Correct 66 ms 6116 KB Output is correct
27 Correct 71 ms 6124 KB Output is correct
28 Correct 77 ms 6112 KB Output is correct
29 Correct 72 ms 6112 KB Output is correct
30 Correct 76 ms 6112 KB Output is correct
31 Correct 79 ms 6232 KB Output is correct
32 Correct 72 ms 6108 KB Output is correct
33 Correct 72 ms 6128 KB Output is correct
34 Correct 76 ms 6112 KB Output is correct
35 Correct 70 ms 6112 KB Output is correct
36 Correct 61 ms 6112 KB Output is correct
37 Correct 69 ms 6112 KB Output is correct
38 Correct 73 ms 6112 KB Output is correct
39 Correct 65 ms 6112 KB Output is correct
40 Correct 76 ms 6112 KB Output is correct
41 Correct 72 ms 6112 KB Output is correct
42 Correct 70 ms 6116 KB Output is correct
43 Correct 73 ms 6112 KB Output is correct