This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "trilib.h"
#include <bits/stdc++.h>
using namespace std;
int n;
set<int> s;
int go(int x){
int y = n;
if(x == n)
y = 1;
for(int j=1;j<=n;j++){
if(j == x || j == y)
continue;
if(x < 1 || x>n || y<1 || y>n )
while(1);
if(is_clockwise(x,y,j))
y = j;
}
return y;
}
int main(){
s.clear();
n = get_n();
for(int i=1;i<=n;i++){
int neighbour = go(i);
if(s.count(neighbour)){
give_answer(n-1);
return 0;
}
s.insert(neighbour);
}
give_answer(n);
}
/*
6
1 1
4 3
2 2
1 4
5 1
3 2
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |