結果

問題 No.947 ABC包囲網
ユーザー cielciel
提出日時 2020-02-23 17:05:30
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 1,113 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 32,128 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-18 10:54:33
合計ジャッジ時間 5,157 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,604 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 56 ms
5,376 KB
testcase_16 AC 16 ms
5,376 KB
testcase_17 AC 18 ms
5,376 KB
testcase_18 AC 48 ms
5,376 KB
testcase_19 AC 48 ms
5,376 KB
testcase_20 AC 49 ms
5,376 KB
testcase_21 AC 48 ms
5,376 KB
testcase_22 AC 49 ms
5,376 KB
testcase_23 AC 48 ms
5,376 KB
testcase_24 AC 48 ms
5,376 KB
testcase_25 AC 48 ms
5,376 KB
testcase_26 AC 48 ms
5,376 KB
testcase_27 AC 48 ms
5,376 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
}
0