| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 25751 | kriii | 별자리 2 (JOI14_constellation2) | C++14 | 1433 ms | 1512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;
int N,X[3030],Y[3030],C[3030];
struct pt{
pt(){}
pt(int x_, int y_, int c_){
x = x_; y = y_; c = c_;
d = atan2(y,x);
}
int x,y,c; double d;
bool operator <(const pt &t)const{
return d < t.d;
}
}P[6060];
double pi = acos(-1.0);
int main()
{
scanf ("%d",&N);
for (int i=0;i<N;i++) scanf ("%d %d %d",&X[i],&Y[i],&C[i]);
long long ans = 0;
for (int v=0;v<N;v++){
int c = 0;
for (int j=0;j<N;j++) if (j != v) P[c++] = pt(X[j]-X[v],Y[j]-Y[v],C[j]);
sort(P,P+c);
int A[3] = {0,};
for (int i=0;i<c;i++){
A[P[i].c]++;
P[i+c] = P[i];
P[i+c].d += 2 * pi;
}
int B[3] = {0,};
for (int i=0,j=0;i<c;i++){
while (P[i].d + pi > P[j].d) B[P[j++].c]++;
long long res = 1;
for (int k=0;k<3;k++) if (k != C[v]) res *= (A[k] - B[k]);
B[P[i].c]--;
for (int k=0;k<3;k++) if (k != P[i].c) res *= B[k];
ans += res;
}
}
printf ("%lld\n",ans/2);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
