結果
問題 | No.947 ABC包囲網 |
ユーザー | fgwiebfaoish |
提出日時 | 2019-12-10 03:41:34 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 1,815 ms / 2,000 ms |
コード長 | 3,385 bytes |
コンパイル時間 | 2,350 ms |
コンパイル使用メモリ | 115,804 KB |
実行使用メモリ | 28,620 KB |
最終ジャッジ日時 | 2024-06-23 14:58:27 |
合計ジャッジ時間 | 39,975 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
26,380 KB |
testcase_01 | AC | 28 ms
24,724 KB |
testcase_02 | AC | 28 ms
26,372 KB |
testcase_03 | AC | 28 ms
24,732 KB |
testcase_04 | AC | 28 ms
24,500 KB |
testcase_05 | AC | 29 ms
26,252 KB |
testcase_06 | AC | 28 ms
24,452 KB |
testcase_07 | AC | 29 ms
26,636 KB |
testcase_08 | AC | 28 ms
24,236 KB |
testcase_09 | AC | 30 ms
24,236 KB |
testcase_10 | AC | 28 ms
24,600 KB |
testcase_11 | AC | 28 ms
26,384 KB |
testcase_12 | AC | 29 ms
24,580 KB |
testcase_13 | AC | 28 ms
26,604 KB |
testcase_14 | AC | 29 ms
24,580 KB |
testcase_15 | AC | 35 ms
24,716 KB |
testcase_16 | AC | 31 ms
24,468 KB |
testcase_17 | AC | 31 ms
24,604 KB |
testcase_18 | AC | 33 ms
24,348 KB |
testcase_19 | AC | 34 ms
26,508 KB |
testcase_20 | AC | 34 ms
24,492 KB |
testcase_21 | AC | 34 ms
24,600 KB |
testcase_22 | AC | 33 ms
22,580 KB |
testcase_23 | AC | 33 ms
24,596 KB |
testcase_24 | AC | 33 ms
26,640 KB |
testcase_25 | AC | 33 ms
24,712 KB |
testcase_26 | AC | 33 ms
24,712 KB |
testcase_27 | AC | 33 ms
24,724 KB |
testcase_28 | AC | 771 ms
26,740 KB |
testcase_29 | AC | 1,815 ms
22,580 KB |
testcase_30 | AC | 1,025 ms
26,600 KB |
testcase_31 | AC | 1,505 ms
26,600 KB |
testcase_32 | AC | 1,504 ms
26,596 KB |
testcase_33 | AC | 1,503 ms
26,480 KB |
testcase_34 | AC | 1,811 ms
26,596 KB |
testcase_35 | AC | 1,516 ms
26,612 KB |
testcase_36 | AC | 1,801 ms
26,604 KB |
testcase_37 | AC | 1,509 ms
28,620 KB |
testcase_38 | AC | 1,516 ms
26,476 KB |
testcase_39 | AC | 1,514 ms
26,580 KB |
testcase_40 | AC | 1,799 ms
24,544 KB |
testcase_41 | AC | 1,485 ms
24,476 KB |
testcase_42 | AC | 1,494 ms
26,576 KB |
testcase_43 | AC | 1,500 ms
24,528 KB |
testcase_44 | AC | 1,495 ms
24,464 KB |
testcase_45 | AC | 1,507 ms
24,596 KB |
testcase_46 | AC | 1,494 ms
24,600 KB |
testcase_47 | AC | 1,506 ms
24,496 KB |
testcase_48 | AC | 1,803 ms
24,668 KB |
testcase_49 | AC | 1,505 ms
26,464 KB |
testcase_50 | AC | 1,495 ms
24,404 KB |
testcase_51 | AC | 28 ms
22,324 KB |
testcase_52 | AC | 29 ms
24,600 KB |
testcase_53 | AC | 30 ms
24,364 KB |
testcase_54 | AC | 28 ms
24,496 KB |
testcase_55 | AC | 28 ms
24,724 KB |
testcase_56 | AC | 28 ms
26,628 KB |
testcase_57 | AC | 35 ms
24,368 KB |
testcase_58 | AC | 35 ms
26,632 KB |
testcase_59 | AC | 34 ms
24,584 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Collections; using System.Collections.Specialized; using System.Linq; using System.Text; using System.IO; using System.Reflection; using static System.Math; using System.Numerics; static class Program{ const int mod=(int)1e9+7; static void Main(){ Sc sc=new Sc(); var n=sc.I; var d=new double[n][]; var g=new double[n]; for(int i = 0;i<n;i++) { d[i]=sc.Da3(false,0,true,0); g[i]=Atan2(d[i][1],d[i][0])*180/PI; d[i][2]=g[i]; } Array.Sort(g); long ans=0; for(int i = 0;i<n-1;i++) { for(int j = i+1;j<n;j++) { var c1=d[i][2]; c1+=Sign(c1)==1?-180:180; var c2=d[j][2]; c2+=Sign(c2)==1?-180:180; if(c1>c2){ var e=c1; c1=c2; c2=e; } if(Abs(c1+180-c2)<1e-12||Abs(c1-c2)<1e-12){continue;} if(c2-c1>180){ ans+=n-g.Bs(c2+1e-12,false)+g.Bs(c1-1e-12,true)+1; } else{ ans+=g.Bs(c2-1e-12,true)-g.Bs(c1+1e-12,false)+1; } } } Console.WriteLine("{0}",ans/3); } } static class Ex1{ public static int Bs(this double[] a,double x,bool b){return Bs2(a,x,b,a.Length);} public static int Bs(this double[] a,double x,bool b,int ub){return Bs2(a,x,b,ub+1);} private static int Bs2(double[] a,double x,bool b,int ub){ int lb=-1,mid=0; while(ub-lb>1){ mid=(ub+lb)/2; if(a[mid]>=x){ub=mid;} else{lb=mid;} } return b?lb:ub; } } public class Sc{ public int I{get{return int.Parse(Console.ReadLine());}} public long L{get{return long.Parse(Console.ReadLine());}} public double D{get{return double.Parse(Console.ReadLine());}} public string S{get{return Console.ReadLine();}} public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}} public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}} public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}} public string[] Sa{get{return Console.ReadLine().Split();}} public object[] Oa{get{return Console.ReadLine().Split();}} public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}} public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);} public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);} public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}} public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);} public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);} public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);} public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;} public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;} public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;} public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;} }