#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const N=2e5+5;
int const mod=1e9+7;
int bk[N],fr[N];
int n;
bool check(){
for(int i=1;i<n;i++){
if(fr[i+1]==2 || bk[i]==n)
continue;
if(fr[i+1]+1>bk[i])
return 0;
}
if(fr[1]==2 || bk[n]==n)
return 1;
if(fr[1]+1>bk[n])
return 0;
return 1;
}
int main(){
int t;
cin>>t;
cin>>n;
string col;
cin>>col;
for(int i=1;i<=n;i++){
fr[i]=2;
bk[i+1]=n;
}
for (int i = 0; i < n-3; ++i)
{
int a,b,c;
cin>>a>>b>>c;
if(a>b)
swap(a,b);
int ba=(b-a)+1;
fr[a]=max(fr[a],ba);
bk[a]=min(bk[a],ba);
int ab=(n+1)-(b-a);
fr[b]=max(fr[b],ab);
bk[b]=min(bk[b],ab);
}
if(check()==0)
cout<<"neispravna triangulacija"<<endl;
else
cout<<"tocno"<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
5244 KB |
Output is correct |
2 |
Correct |
92 ms |
5368 KB |
Output is correct |
3 |
Correct |
104 ms |
5384 KB |
Output is correct |
4 |
Correct |
120 ms |
5240 KB |
Output is correct |
5 |
Correct |
96 ms |
5348 KB |
Output is correct |
6 |
Incorrect |
82 ms |
5380 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
5344 KB |
Output is correct |
2 |
Correct |
137 ms |
5260 KB |
Output is correct |
3 |
Incorrect |
88 ms |
5508 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |