제출 #444144

#제출 시각아이디문제언어결과실행 시간메모리
444144Haruto810198Triangles (CEOI18_tri)C++17
컴파일 에러
0 ms0 KiB
//#include <bits/stdc++.h> #include "trilib.c" 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; }

컴파일 시 표준 에러 (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];
      |      ^~~~~
/usr/bin/ld: /tmp/cceOoVO9.o: in function `get_n':
tri.cpp:(.text+0x120): multiple definition of `get_n'; /tmp/ccrFhUxb.o:trilib.c:(.text+0x120): first defined here
/usr/bin/ld: /tmp/cceOoVO9.o: in function `is_clockwise':
tri.cpp:(.text+0x190): multiple definition of `is_clockwise'; /tmp/ccrFhUxb.o:trilib.c:(.text+0x190): first defined here
/usr/bin/ld: /tmp/cceOoVO9.o: in function `give_answer':
tri.cpp:(.text+0x2f0): multiple definition of `give_answer'; /tmp/ccrFhUxb.o:trilib.c:(.text+0x2f0): first defined here
collect2: error: ld returned 1 exit status