結果
問題 | No.947 ABC包囲網 |
ユーザー |
|
提出日時 | 2020-02-23 17:05:30 |
言語 | C (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,113 bytes |
コンパイル時間 | 589 ms |
コンパイル使用メモリ | 31,488 KB |
実行使用メモリ | 8,612 KB |
最終ジャッジ日時 | 2024-10-10 04:08:12 |
合計ジャッジ時間 | 5,168 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 TLE * 1 -- * 31 |
ソースコード
#include <stdio.h>#include <stdlib.h>#include <stdbool.h>typedef __int128_t T;bool F(T d,T e,T f,T g,T h,T i,T m,T n){return (f-d)*(n-e)*(f=(h-f)*(n-g)-(m-f)*(i-g))>f*(m-d)*(g-e)&f*(d-h)*(n-i)>f*(m-h)*(e-i);}int X[4000],Y[4000];typedef struct{int i;long long R;}tR;tR* process(tR* R){//R->R=0;int i=R->i;long long r=0;for(int j=0;j<i;j++)for(int k=0;k<j;k++){if(F(X[i],Y[i],X[j],Y[j],X[k],Y[k],0,0))r++;}R->R=r;return R;}int main(){long long r=0;int n=0;scanf("%d",&n);for(int i=0;i<n;i++)scanf("%d%d",X+i,Y+i);int nthreads=1;//pthread_t *threads=(pthread_t*)alloca(sizeof(pthread_t)*nthreads);for(int i=0;i<n;i+=nthreads){tR *Rmain;int i0=0;for(;i0<nthreads;i0++){if(i+i0>=n)break;tR *R=malloc(sizeof(tR));R->i=i+i0;if(i0<nthreads-1){//pthread_create(&threads[i0],NULL,(void*(*)(void*))process,R);}else{Rmain=R;process(R);}}for(int i1=0;i1<i0;i1++){tR *R;if(i1<nthreads-1){//pthread_join(threads[i1],(void**)&R);}else{R=Rmain;}r+=R->R;free(R);}}printf("%lld\n",r);}