# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1013146 |
2024-07-03T08:26:22 Z |
vjudge1 |
Checker (COCI19_checker) |
C++17 |
|
3000 ms |
56376 KB |
#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;
map<pair<int,int>,int> mp;
bool check1(){
for(int i=1;i<n;i++)
if(fr[i+1]+1>bk[i])
return 0;
if(fr[1]+1>bk[n])
return 0;
return 1;
}
bool is(int a,int b){
if(mp.find({a,b})!=mp.end())
return 1;
return 0;
}
bool diff(int a,int b,int c){
if(mp[{a,b}]!=mp[{b,c}] && mp[{b,c}]!=mp[{c,a}])
return 1;
return 0;
}
bool check2(){
vector<int> v1,v2;
for (int i = 1; i <=n; ++i)
v1.push_back(i);
while(v1.size()>2){
int sz=v1.size();
if(is(v1[sz-1],v1[1])){
if(diff(v1[sz-1],v1[0],v1[1])==0)
return 0;
}
else
v2.push_back(v1[0]);
for(int i=1;i<sz-1;i++){
if(is(v1[i-1],v1[i+1])){
if(diff(v1[i-1],v1[i],v1[i+1])==0)
return 0;
}
else
v2.push_back(v1[i]);
}
if(is(v1[sz-2],v1[0])){
if(diff(v1[sz-2],v1[sz-1],v1[0])==0)
return 0;
}
else
v2.push_back(v1[sz-1]);
// for(int i:v1)
// cout<<i<<' ';
// cout<<endl;
v1=v2;
v2.clear();
}
return 1;
}
int main(){
int t;
cin>>t;
cin>>n;
string col;
cin>>col;
for(int i=0;i<n-1;i++){
mp[{i+1,i+2}]=col[i]-'0';
mp[{i+2,i+1}]=col[i]-'0';
}
mp[{n,1}]=col[n-1]-'0';
mp[{1,n}]=col[n-1]-'0';
for(int i=1;i<=n;i++){
fr[i]=2;
bk[i]=n;
}
for (int i = 0; i < n-3; ++i)
{
int a,b,c;
cin>>a>>b>>c;
mp[{a,b}]=c;
mp[{b,a}]=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);
}
// for (int i = 1; i <=n; ++i)
// cout<<fr[i]<<' '<<bk[i]<<endl;
if(check1()==0)
cout<<"neispravna triangulacija"<<endl;
else if(check2()==0)
cout<<"neispravno bojenje"<<endl;
else
cout<<"tocno"<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
440 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
440 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1871 ms |
56376 KB |
Output is correct |
2 |
Correct |
1757 ms |
56220 KB |
Output is correct |
3 |
Correct |
421 ms |
54072 KB |
Output is correct |
4 |
Correct |
454 ms |
53988 KB |
Output is correct |
5 |
Correct |
469 ms |
53988 KB |
Output is correct |
6 |
Execution timed out |
3078 ms |
56196 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1731 ms |
56152 KB |
Output is correct |
2 |
Correct |
1776 ms |
56148 KB |
Output is correct |
3 |
Correct |
776 ms |
56376 KB |
Output is correct |
4 |
Correct |
613 ms |
56184 KB |
Output is correct |
5 |
Correct |
415 ms |
55128 KB |
Output is correct |
6 |
Execution timed out |
3097 ms |
56148 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
440 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |