Submission #38265

#TimeUsernameProblemLanguageResultExecution timeMemory
38265youngyojun별자리 2 (JOI14_constellation2)C++11
55 / 100
9000 ms2072 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; ll operator * (const pll& A, const pll& B) { return A.first*B.second - B.first*A.second; } ll ccw(const pll& A, const pll& B, const pll& C) { return A*B + B*C + C*A; } const int MAXN = 3005; pll P[MAXN]; int A[MAXN]; ll Ans; int N; int main() { scanf("%d", &N); for(int i = 1; i <= N; i++) { scanf("%lld%lld", &P[i].first, &P[i].second); scanf("%d", &A[i]); } for(int i = 1; i < N; i++) for(int j = i+1; j <= N; j++) { int l[3] = {0, }, r[3] = {0, }; for(int k = 1; k <= N; k++) { if(k == i || k == j) continue; (ccw(P[i], P[j], P[k]) < 0 ? l : r)[A[k]]++; } int tmp1 = l[A[i]], tmp2 = r[A[j]]; l[A[i]] = r[A[j]] = 1; Ans += (ll)l[0] * l[1] * l[2] * r[0] * r[1] * r[2]; l[A[i]] = tmp1; r[A[j]] = tmp2; l[A[j]] = r[A[i]] = 1; Ans += (ll)l[0] * l[1] * l[2] * r[0] * r[1] * r[2]; } Ans /= 2; printf("%lld\n", Ans); return 0; }

Compilation message (stderr)

constellation2.cpp: In function 'int main()':
constellation2.cpp:21:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
constellation2.cpp:23:47: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &P[i].first, &P[i].second);
                                               ^
constellation2.cpp:24:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &A[i]);
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...