結果
| 問題 |
No.488 四角関係
|
| コンテスト | |
| ユーザー |
btk
|
| 提出日時 | 2017-02-24 23:21:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 5,000 ms |
| コード長 | 1,233 bytes |
| コンパイル時間 | 2,023 ms |
| コンパイル使用メモリ | 167,044 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-02 23:53:42 |
| 合計ジャッジ時間 | 2,507 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
struct cww{cww(){
ios::sync_with_stdio(false);cin.tie(0);
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
template <typename T>inline void chmin(T &l,T r){l=min(l,r);}
template <typename T>inline void chmax(T &l,T r){l=max(l,r);}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
for(auto &it:v)is>>it;
return is;
}
typedef vector<int> V;
typedef vector<V> VV;
int main(){
int N,M;
cin>>N>>M;
VV g(N,V(N,0));
REP(i,M){
int a,b;
cin>>a>>b;
g[a][b]=g[b][a]=1;
}
int res=0;
REP(a,N)FOR(b,a+1,N)FOR(c,b+1,N)FOR(d,c+1,N){
vector<int> v={a,b,c,d};
vector<int> u={1,2,3};
int ok=0;
do{
ok|=(g[v[0]][v[u[0]]])
&(g[v[u[0]]][v[u[1]]])
&(g[v[u[1]]][v[u[2]]])
&(g[v[0]][v[u[2]]])
&(!g[v[u[0]]][v[u[2]]])
&(!g[v[0]][v[u[1]]]);
}while(next_permutation(u.begin(),u.end()));
res+=ok;
}
cout<<res<<endl;
return 0;
}
btk