#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
//#define endl '\n'
int n;
string sides;
set<int> al[200005];
struct trip{
int a,b,c;
trip (int _a,int _b,int _c){
a=_a,b=_b,c=_c;
}
};
vector<trip> tri;
map<ii,char> color;
ii start=ii(-1,-1);
bool dfs(int i,int j){
//cout<<i<<" "<<j<<endl;
//note here that it returns true if triangulation does not exist
if ((j+1)%n==i){
al[i].erase(j);
al[j].erase(i);
return false;
}
else{
auto curr=al[i].find(j);
auto it=(curr==(--al[i].end()))?al[i].begin():next(curr);
//cout<<"DEBUG: "<<i<<" "<<*it<<" "<<j<<endl;
tri.push_back(trip(i,j,*it));
if (i<j && i<*it && *it<j) return true;
if (j<i && (i<*it || *it<j)) return true;
al[i].erase(j);
al[j].erase(i);
if (dfs(i,*it)||dfs(*it,j)) return true;
return false;
}
}
int main(){
cout<<"tocno";
}
//neispravna triangulacija -2
//neispravno bojenje -1
//tocno 0
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9728 KB |
Output is correct |
2 |
Correct |
10 ms |
9728 KB |
Output is correct |
3 |
Incorrect |
10 ms |
9728 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9728 KB |
Output is correct |
2 |
Correct |
10 ms |
9728 KB |
Output is correct |
3 |
Incorrect |
10 ms |
9728 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
9728 KB |
Output is correct |
2 |
Correct |
10 ms |
9728 KB |
Output is correct |
3 |
Incorrect |
10 ms |
9856 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9728 KB |
Output is correct |
2 |
Correct |
10 ms |
9728 KB |
Output is correct |
3 |
Incorrect |
10 ms |
9728 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
9728 KB |
Output is correct |
2 |
Correct |
10 ms |
9728 KB |
Output is correct |
3 |
Incorrect |
10 ms |
9728 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |