結果
問題 |
No.488 四角関係
|
ユーザー |
![]() |
提出日時 | 2025-02-22 21:23:26 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 766 bytes |
コンパイル時間 | 6,090 ms |
コンパイル使用メモリ | 252,252 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-02-22 21:23:40 |
合計ジャッジ時間 | 6,920 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; int mp[55][55],ans,n,m,x,y; bool check(int a,int b,int c,int d){ if (mp[a][b]+mp[a][c]+mp[a][d]==3) return 0; if (mp[a][b]+mp[b][c]+mp[b][d]==3) return 0; if (mp[a][c]+mp[b][c]+mp[c][d]==3) return 0; if (mp[a][d]+mp[b][d]+mp[c][d]==3) return 0; if (mp[a][b]+mp[a][c]+mp[a][d]+mp[b][c]+mp[b][d]+mp[c][d]==4) { //cout<<a<<' '<<b<<' '<<c<<' '<<d<<'\n'; return 1; } return 0; } signed main () { freopen("rec.in","r",stdin); freopen("rec.out","w",stdout); cin>>n>>m; for (int i=1;i<=m;i++){ cin>>x>>y; mp[x][y]++; mp[y][x]++; } for (int a=0;a<=n;a++) for (int b=a+1;b<=n;b++) for (int c=b+1;c<=n;c++) for (int d=c+1;d<=n;d++){ if (check(a,b,c,d)) ans++; } cout<<ans; return 0; }