結果
問題 |
No.488 四角関係
|
ユーザー |
![]() |
提出日時 | 2017-09-01 16:31:39 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,152 bytes |
コンパイル時間 | 5,468 ms |
コンパイル使用メモリ | 77,260 KB |
実行使用メモリ | 45,096 KB |
最終ジャッジ日時 | 2024-11-06 17:23:23 |
合計ジャッジ時間 | 10,978 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 8 |
ソースコード
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);} }