제출 #119950

#제출 시각아이디문제언어결과실행 시간메모리
119950davitmargTriangles (CEOI18_tri)C++17
컴파일 에러
0 ms0 KiB
/*DavitMarg*/ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <set> #include <queue> #include <iomanip> #include <stack> #include <cassert> #include <iterator> #include <bitset> #include <fstream> #ifndef death #include<trilib.h> #endif // death #define mod 1000000007ll #define LL long long #define LD long double #define MP make_pair #define PB push_back #define all(v) v.begin(),v.end() using namespace std; #ifdef death int get_n() { int x; cin >> x; return x; } vector<pair<LL, LL>> point; bool is_clockwise(int a, int b, int c) { pair<LL, LL> A, B, C; A = point[a]; B = point[b]; C = point[c]; return A.first * (B.second - C.second) + B.first * (C.second - A.second) + C.first * (A.second - B.second) < 0; } void give_answer(int x) { cout << x << endl; } #endif // death bitset<502> is, used[502][502], pre[502][502]; bool cw(int a, int b, int c) { if (used[a][b][c]) return pre[a][b][c]; used[a][b][c] = 1; used[b][c][a] = 1; used[c][a][b] = 1; used[c][b][a] = 1; used[a][c][b] = 1; used[b][a][c] = 1; pre[a][b][c] = pre[c][a][b] = pre[b][c][a] = is_clockwise(a, b, c); pre[c][b][a] = pre[b][a][c] = pre[a][c][b] = !pre[a][b][c]; return pre[a][b][c]; } bool ccw(int a, int b, int c) { return !cw(a, b, c); } int ans, n; vector<int> p; int main() { n = get_n(); #ifdef death point.PB(MP(0, 0)); for (int i = 0; i < n; i++) { LL x, y; cin >> x >> y; point.PB(MP(x, y)); } #endif // death srand(5848648); for (int i = 0; i < n; i++) p.PB(i + 1); random_shuffle(all(p)); bool p=0; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) { int sum = 0; int cnt = 0; if(is[i] || is[j]) { if(!p) p=1; else continue; } for (int k = 0; k < n; k++) { if (k == i || k == j) continue; cnt++; sum += cw(p[i], p[k], p[j]); if (sum && sum != cnt) break; } if(is[i] || is[j]) p=!(sum == n - 2 || sum == 0); is[i]=is[j]=(sum == n - 2 || sum == 0); ans += (sum == n - 2 || sum == 0); } give_answer(ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

tri.cpp: In function 'int main()':
tri.cpp:123:18: error: invalid types 'bool[int]' for array subscript
     sum += cw(p[i], p[k], p[j]);
                  ^
tri.cpp:123:24: error: invalid types 'bool[int]' for array subscript
     sum += cw(p[i], p[k], p[j]);
                        ^
tri.cpp:123:30: error: invalid types 'bool[int]' for array subscript
     sum += cw(p[i], p[k], p[j]);
                              ^