結果
問題 | No.488 四角関係 |
ユーザー | fjafjafja |
提出日時 | 2017-09-01 16:31:39 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,152 bytes |
コンパイル時間 | 4,024 ms |
コンパイル使用メモリ | 77,424 KB |
実行使用メモリ | 44,872 KB |
最終ジャッジ日時 | 2024-04-24 09:53:15 |
合計ジャッジ時間 | 8,877 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 151 ms
41,776 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 110 ms
40,952 KB |
testcase_10 | AC | 135 ms
41,892 KB |
testcase_11 | AC | 124 ms
41,472 KB |
testcase_12 | AC | 133 ms
41,580 KB |
testcase_13 | AC | 141 ms
41,980 KB |
testcase_14 | AC | 133 ms
41,244 KB |
testcase_15 | AC | 113 ms
40,224 KB |
testcase_16 | AC | 122 ms
41,024 KB |
testcase_17 | AC | 113 ms
40,172 KB |
testcase_18 | AC | 109 ms
40,040 KB |
testcase_19 | AC | 121 ms
41,216 KB |
testcase_20 | AC | 104 ms
40,132 KB |
testcase_21 | AC | 109 ms
40,008 KB |
testcase_22 | AC | 103 ms
39,912 KB |
testcase_23 | AC | 114 ms
40,928 KB |
testcase_24 | AC | 117 ms
41,240 KB |
ソースコード
package yukicoder; import java.util.Scanner; public class N488 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int M=sc.nextInt(); int abuf=0; int bbuf=0; int cnt=0; int end=0; long[] a=new long[N],b=new long[M]; for(int i=0;i<M;i++) { abuf=sc.nextInt(); bbuf=sc.nextInt(); a[(abuf<bbuf)?abuf:bbuf]+=(int)Math.pow(2,(abuf>bbuf)?abuf:bbuf); } for(int i=0;i<N-3;i++) { for(int j=i+1;j<N-2;j++) { for(int k=j+1;k<N-1;k++) { for(int l=k+1;l<N;l++) { end=0; if(!check(a[i],j)&&check(a[i],k)&&check(a[i],l)&&check(a[j],k)&&check(a[j],l)&&!check(a[k],l)) { end++; cnt++; } if(end!=1&&check(a[i],j)&&!check(a[i],k)&&check(a[i],l)&&check(a[j],k)&&check(a[k],l)&&!check(a[j],l)) { end++; cnt++; } if(end!=1&&check(a[i],j)&&check(a[i],k)&&!check(a[i],l)&&check(a[j],l)&&check(a[k],l)&&!check(a[j],k)) { cnt++; } } } } } System.out.println(cnt); } static boolean check(long a,int index) { return ((a&(int)Math.pow(2, index))!=0);} }