Submission #576585

#TimeUsernameProblemLanguageResultExecution timeMemory
576585AGEChecker (COCI19_checker)C++14
0 / 110
19 ms23796 KiB
#include <bits/stdc++.h> #define int long long #define F first #define S second #define pb push_back using namespace std; const int N=1e6,M=3e3+2,mod=1e9+7; int out[N]; int x[N],y[N],z[N]; vector< pair< int,int> >adj[N]; main() { int n; cin>>n; string s; cin>>s; map< pair<int,int> , pair<int,int> > mp; for(int i=1;i<=n;i++){ if(i==n) mp[{n,1}]={1,s[i-1]-'0'},mp[{1,n}]={1,s[i-1]-'0'}; mp[{i,i+1}]={1,s[i-1]-'0'}; mp[{i+1,i}]={1,s[i-1]-'0'}; } for(int i=0;i<n-3;i++){ cin>>x[i]>>y[i]>>z[i]; adj[x[i]].pb({y[i],z[i]}); adj[y[i]].pb({x[i],z[i]}); mp[{x[i],y[i]}]={1,z[i]}; mp[{y[i],x[i]}]={1,z[i]}; } int ok=0; for(int i=0;i<n-3;i++){ for(int j=0;j<n-3;j++){ if(i==j) continue; if(min(x[i],y[i])>min(x[j],y[j])&&max(x[i],y[i])<max(x[j],y[j])) ok=1; else if(min(x[i],y[i])<min(x[j],y[j])&&max(x[i],y[i])>max(x[j],y[j])) ok=1; } } int ok2=0; for(int i=0;i<n-3;i++){ for(int j=1;j<=n;j++){ if(j==x[i]||j==y[i]) continue; pair<int,int> p; p={0,0}; if((mp[{x[i],j}].F!=0)&&(mp[{y[i],j}].F!=0)){ if(mp[{x[i],j}].S==mp[{y[i],j}].S||mp[{x[i],j}].S==z[i]||mp[{y[i],j}].S==z[i]) ok2=1; } } } if(ok2==0&&ok==0) cout<<"tecno"<<endl; else if(ok==0&&ok2==1) cout<<"neispravno bojenje"<<endl; else cout<<"neispravna triangulacija"<<endl; return 0; }

Compilation message (stderr)

checker.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main()
      | ^~~~
#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...