結果

問題 No.947 ABC包囲網
ユーザー 37zigen37zigen
提出日時 2020-04-04 18:19:38
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,285 bytes
コンパイル時間 3,949 ms
コンパイル使用メモリ 81,480 KB
実行使用メモリ 64,036 KB
最終ジャッジ日時 2023-09-16 06:04:23
合計ジャッジ時間 22,444 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
57,652 KB
testcase_01 AC 128 ms
57,528 KB
testcase_02 AC 130 ms
57,752 KB
testcase_03 AC 129 ms
57,228 KB
testcase_04 AC 125 ms
57,548 KB
testcase_05 AC 128 ms
57,444 KB
testcase_06 AC 130 ms
57,184 KB
testcase_07 WA -
testcase_08 AC 129 ms
57,424 KB
testcase_09 AC 128 ms
57,228 KB
testcase_10 AC 133 ms
57,424 KB
testcase_11 AC 129 ms
57,432 KB
testcase_12 AC 137 ms
57,776 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 172 ms
57,712 KB
testcase_17 WA -
testcase_18 AC 207 ms
58,856 KB
testcase_19 AC 211 ms
58,740 KB
testcase_20 AC 211 ms
58,604 KB
testcase_21 AC 213 ms
58,524 KB
testcase_22 AC 212 ms
58,472 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 199 ms
58,608 KB
testcase_26 AC 202 ms
58,356 KB
testcase_27 AC 196 ms
58,616 KB
testcase_28 AC 434 ms
62,112 KB
testcase_29 AC 367 ms
62,108 KB
testcase_30 AC 415 ms
62,532 KB
testcase_31 AC 398 ms
62,092 KB
testcase_32 AC 446 ms
63,832 KB
testcase_33 AC 426 ms
62,300 KB
testcase_34 AC 455 ms
62,264 KB
testcase_35 AC 419 ms
62,484 KB
testcase_36 AC 440 ms
62,120 KB
testcase_37 AC 427 ms
62,184 KB
testcase_38 AC 407 ms
62,044 KB
testcase_39 AC 440 ms
62,280 KB
testcase_40 AC 393 ms
62,708 KB
testcase_41 WA -
testcase_42 AC 411 ms
61,720 KB
testcase_43 AC 386 ms
61,936 KB
testcase_44 AC 379 ms
62,200 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 377 ms
62,332 KB
testcase_49 AC 399 ms
62,272 KB
testcase_50 WA -
testcase_51 AC 147 ms
57,520 KB
testcase_52 AC 148 ms
57,548 KB
testcase_53 AC 147 ms
57,184 KB
testcase_54 AC 133 ms
57,228 KB
testcase_55 AC 133 ms
57,188 KB
testcase_56 WA -
testcase_57 AC 206 ms
56,520 KB
testcase_58 AC 213 ms
58,192 KB
testcase_59 AC 218 ms
58,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main implements Runnable{

	public static void main(String[] args) {
		new Thread(null,new Main(), "" ,Runtime.getRuntime().maxMemory()).start();
	}
	
	public void run() {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		long[][] P=new long[N][2];
		for(int i=0;i<N;++i) {
			P[i][0]=sc.nextLong();
			P[i][1]=sc.nextLong();
		}
		Arrays.sort(P, new Comparator<long[]>() {
			@Override
			public int compare(long[] o1, long[] o2) {
				double ang1=Math.atan2(o1[1], o1[0]);
				double ang2=Math.atan2(o2[1], o2[0]);
				if(ang1<0)ang1+=Math.PI*2;
				if(ang2<0)ang2+=Math.PI*2;
				if(Math.abs(ang1-ang2)>Math.PI/4)return Double.compare(ang1, ang2);
				return Long.signum(-(o1[0]*o2[1]-o1[1]*o2[0]));
			}
		});
		long ans=0;
		for(int i=0;i+1<N;++i) {
			if(P[i][1]<=0)break;
			int first=i+1;
			while(first<N&&P[i][0]*P[first][1]-P[i][1]*P[first][0]>=0)++first;
			int last=first;
			for(int j=i+1;j<first;++j) {
				if(P[i][0]*P[j][1]-P[i][1]*P[j][0]<=0)continue;
				while(last<N&&P[j][0]*P[last][1]-P[j][1]*P[last][0]>0)++last;
				ans+=last-first;
			}
		}
		System.out.println(ans);
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}

0