# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
25816 |
2017-06-24T08:32:14 Z |
김현수(#1080) |
별자리 2 (JOI14_constellation2) |
C++11 |
|
9000 ms |
2020 KB |
#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
ll n, ans;
vector<pll> a[3];
ll ccw (pll &A, pll &B, pll &C) {
ll V = (A.X*B.Y + B.X*C.Y + C.X*A.Y) - (A.Y*B.X + B.Y*C.X + C.Y*A.X);
if(V == 0) return 0;
return 2*(V>0) - 1;
}
bool in (pll &A, pll &B, pll &C, pll &D) {
ll X = ccw(A, B, D), Y = ccw(B, C, D), Z = ccw(C, A, D);
return (X == Y && Y == Z);
}
bool in (pll &A, pll &B, pll &C, pll &D, pll &E, pll &F) {
bool X = in(A,B,C,D), Y = in(A,B,C,E), Z = in(A,B,C,F);
return (X && Y && Z);
}
bool its (pll &A, pll &B, pll &C, pll &D) {
return (ccw(A, B, C) != ccw(A, B, D)) && (ccw(C, D, A) != ccw(C, D, B));
}
int main()
{
scanf("%lld",&n);
for(ll i=0;i<n;i++) {
pll T; ll C;
scanf("%lld%lld%lld",&T.X,&T.Y,&C);
a[C].push_back(T);
}
for(auto &A : a[0]) for(auto &B : a[1]) for(auto &C : a[2]) {
for(auto &D : a[0]) for(auto &E : a[1]) for(auto &F : a[2]) {
if(A == D || B == E || C == F) continue;
if(in(A, B, C, D, E, F) || in(D, E, F, A, B, C)) continue;
if(its(A, B, D, E) || its(A, B, E, F) || its(A, B, F, D)) continue;
if(its(B, C, D, E) || its(B, C, E, F) || its(B, C, F, D)) continue;
if(its(C, A, D, E) || its(C, A, E, F) || its(C, A, F, D)) continue;
ans++;
}
}
printf("%lld\n",ans/2);
}
Compilation message
constellation2.cpp: In function 'int main()':
constellation2.cpp:32:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&n);
^
constellation2.cpp:35:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld%lld%lld",&T.X,&T.Y,&C);
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2020 KB |
Output is correct |
2 |
Correct |
0 ms |
2020 KB |
Output is correct |
3 |
Correct |
0 ms |
2020 KB |
Output is correct |
4 |
Correct |
0 ms |
2020 KB |
Output is correct |
5 |
Correct |
6 ms |
2020 KB |
Output is correct |
6 |
Correct |
26 ms |
2020 KB |
Output is correct |
7 |
Correct |
73 ms |
2020 KB |
Output is correct |
8 |
Correct |
53 ms |
2020 KB |
Output is correct |
9 |
Correct |
63 ms |
2020 KB |
Output is correct |
10 |
Correct |
26 ms |
2020 KB |
Output is correct |
11 |
Correct |
79 ms |
2020 KB |
Output is correct |
12 |
Correct |
86 ms |
2020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1436 ms |
2020 KB |
Output is correct |
2 |
Correct |
2306 ms |
2020 KB |
Output is correct |
3 |
Execution timed out |
9000 ms |
2020 KB |
Execution timed out |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9000 ms |
2020 KB |
Execution timed out |
2 |
Halted |
0 ms |
0 KB |
- |