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;
#define int long long
#define double long double
#define FOR(i, l, r, d) for(int i=(l); i<=(r); i+=(d))
#define szof(x) ((int)(x).size())
#define vi vector<int>
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define mkp make_pair
const int INF = 2147483647;
const int LNF = INF*INF;
const int MOD = 1000000007;
const int mod = 998244353;
const int MAX = 40010;
int N;
bool is_CH[MAX];
int res;
void is_CH_edge(int u, int v){
bool L=0, R=0;
FOR(i, 1, N, 1){
if(i==u or i==v) continue;
bool ans = is_clockwise(u, v, i);
if(ans == true){
R = 1;
}
else{
L = 1;
}
}
if(L==0 or R==0){
is_CH[u] = 1;
is_CH[v] = 1;
}
}
signed main(){
//ios_base::sync_with_stdio(false);
//cin.tie(0);
//cout.tie(0);
N = get_n();
FOR(i, 1, N, 1){
is_CH[MAX] = 0;
}
FOR(i, 1, N, 1){
FOR(j, i+1, N, 1){
is_CH_edge(i, j);
}
}
res = 0;
FOR(i, 1, N, 1){
res += is_CH[i];
}
give_answer(res);
return 0;
}
Compilation message (stderr)
tri.cpp: In function 'int main()':
tri.cpp:64:18: warning: array subscript 40010 is above array bounds of 'bool [40010]' [-Warray-bounds]
64 | is_CH[MAX] = 0;
| ~~~~~~~~~^
tri.cpp:30:6: note: while referencing 'is_CH'
30 | bool is_CH[MAX];
| ^~~~~
# | 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... |