Submission #711716

# Submission time Handle Problem Language Result Execution time Memory
711716 2023-03-17T11:36:36 Z willychan Checker (COCI19_checker) C++14
0 / 110
298 ms 50676 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds


vector<map<int,int> > edge;
vector<int> rt;
vector<int> lt;
int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int t;cin>>t;
	int n;cin>>n;
	rt.resize(n);
	lt.resize(n);
	edge.resize(n);
	vector<bool> vis;
	vis.resize(n);
	string s;cin>>s;	
	for(int i=0;i<n;i++){
		edge[i][(i+1)%n] = s[i]-'0';
		edge[(i+1)%n][i] = s[i]-'0';
		rt[i] = (i+1)%n;
		lt[(i+1)%n] = i;
	}
	for(int i=0;i<n-3;i++){
		int a,b,c;cin>>a>>b>>c;
		a--;b--;
		edge[a][b] = c;
		edge[b][a] = c;
	}
	queue<int> tobe;
	for(int i=0;i<n;i++){
		if(edge[rt[i]].count(lt[i])) tobe.push(i);
	}
	bool par = 1;
		
	while(tobe.size() && n>=3)	{
		int cur = tobe.front();
		tobe.pop();
		n--;
		int a = rt[cur];
		int b = lt[cur];
		int c1 = edge[cur][a];
		int c2 = edge[cur][b];
		int c3 = edge[a][b];
		if(c1 == c2 || c2==c3 || c1==c3) par=0;
		rt[a] = b;
		lt[b] = a;
		if(edge[rt[a]].count(lt[a])) tobe.push(a);
		if(edge[rt[b]].count(lt[b])) tobe.push(b);
	}
	if(n!=2){
		cout<<"neispravna triangulacija"<<"\n";
	}
	if(par){
		cout<<"tocno\n";
	}else{
		cout<<"neispravno bojenje\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 298 ms 50652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 269 ms 50676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -