#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 xx;
cin>>xx;
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])<max(x[j],y[j]))&&(max(x[i],y[i])>max(x[j],y[j]))&&(min(x[i],y[i])>min(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==mp[{x[i],y[i]}].S)||(mp[{y[i],j}].S==z[i]))
ok2=1;
}
}
}
if(ok2==0&&ok==0)
cout<<"tocno"<<endl;
else if(ok==0&&ok2==1)
cout<<"neispravno bojenje"<<endl;
else
cout<<"neispravna triangulacija"<<endl;
return 0;
}
Compilation message
checker.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
12 | main()
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
24148 KB |
Output is correct |
2 |
Correct |
14 ms |
24148 KB |
Output is correct |
3 |
Correct |
14 ms |
24180 KB |
Output is correct |
4 |
Correct |
18 ms |
24276 KB |
Output is correct |
5 |
Correct |
15 ms |
24308 KB |
Output is correct |
6 |
Correct |
14 ms |
24204 KB |
Output is correct |
7 |
Correct |
15 ms |
24172 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
24148 KB |
Output is correct |
2 |
Correct |
14 ms |
24148 KB |
Output is correct |
3 |
Correct |
14 ms |
24180 KB |
Output is correct |
4 |
Correct |
18 ms |
24276 KB |
Output is correct |
5 |
Correct |
15 ms |
24308 KB |
Output is correct |
6 |
Correct |
14 ms |
24204 KB |
Output is correct |
7 |
Correct |
15 ms |
24172 KB |
Output is correct |
8 |
Correct |
548 ms |
196664 KB |
Output is correct |
9 |
Correct |
549 ms |
198472 KB |
Output is correct |
10 |
Correct |
542 ms |
198008 KB |
Output is correct |
11 |
Correct |
555 ms |
206620 KB |
Output is correct |
12 |
Correct |
556 ms |
199244 KB |
Output is correct |
13 |
Correct |
559 ms |
202680 KB |
Output is correct |
14 |
Correct |
546 ms |
199500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3067 ms |
101408 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3065 ms |
101468 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
24148 KB |
Output is correct |
2 |
Correct |
14 ms |
24148 KB |
Output is correct |
3 |
Correct |
14 ms |
24180 KB |
Output is correct |
4 |
Correct |
18 ms |
24276 KB |
Output is correct |
5 |
Correct |
15 ms |
24308 KB |
Output is correct |
6 |
Correct |
14 ms |
24204 KB |
Output is correct |
7 |
Correct |
15 ms |
24172 KB |
Output is correct |
8 |
Correct |
548 ms |
196664 KB |
Output is correct |
9 |
Correct |
549 ms |
198472 KB |
Output is correct |
10 |
Correct |
542 ms |
198008 KB |
Output is correct |
11 |
Correct |
555 ms |
206620 KB |
Output is correct |
12 |
Correct |
556 ms |
199244 KB |
Output is correct |
13 |
Correct |
559 ms |
202680 KB |
Output is correct |
14 |
Correct |
546 ms |
199500 KB |
Output is correct |
15 |
Execution timed out |
3067 ms |
101408 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |