結果
問題 | No.488 四角関係 |
ユーザー |
![]() |
提出日時 | 2017-02-24 22:52:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 668 ms |
コンパイル使用メモリ | 60,524 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-02 23:30:33 |
合計ジャッジ時間 | 1,626 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<iostream>using namespace std;int path[55][55];int check(int a,int b,int c,int d){if(a==b)return 1;if(a==c)return 1;if(a==d)return 1;if(b==c)return 1;if(b==d)return 1;if(c==d)return 1;return 0;}int main(){int n,m;int i,j,k,l;int a,b,c,s=0;cin>>n>>m;for(i=0;i<m;i++){cin>>a>>b;path[a][b]=1;path[b][a]=1;}for(i=0;i<n;i++){for(j=0;j<n;j++){for(k=0;k<n;k++){for(l=0;l<n;l++){if(check(i,j,k,l)==1)continue;a=path[i][j]+path[j][k]+path[k][l]+path[l][i];a-=path[i][k]+path[j][l];if(a==4)s++;}}}}cout<<s/8<<endl;return 0;}