Submission #711800

#TimeUsernameProblemLanguageResultExecution timeMemory
711800willychanChecker (COCI19_checker)C++14
0 / 110
311 ms49544 KiB
#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; vector<bool> vis; int n; bool par = 1; void dfs(int cur){ if(vis[cur]) return ; n--; //cout<<cur<<":\n"; vis[cur]=1; int a = rt[cur]; int b = lt[cur]; int c1 = edge[a][b]; int c2 = edge[a][cur]; int c3 = edge[b][cur]; if(c1==c2 || c2==c3 || c3==c1) par = 0; rt[b] = a; lt[a] = b; /*for(int i=0;i<lt.size();i++){ cout<<i<<":"<<lt[i]<<" "<<rt[i]<<"\n"; }*/ if(edge[rt[a]].count(lt[a])) dfs(a); if(edge[rt[b]].count(lt[b])) dfs(b); } 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); edge.resize(n); 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; } for(int i=0;i<n;i++){ if(edge[rt[i]].count(lt[i])) dfs(i); } /*if(n>2){ cout<<"neispravna triangulacija\n"; return 0; }*/ if(par){ cout<<"tocno\n"; }else{ cout<<"neispravno bojenje\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...