結果
| 問題 |
No.488 四角関係
|
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2018-03-23 21:14:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 1,043 bytes |
| コンパイル時間 | 826 ms |
| コンパイル使用メモリ | 88,936 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 21:33:48 |
| 合計ジャッジ時間 | 1,858 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
int N,M;
cin >> N >> M;
vector< vector<int> > P(N,vector<int>(N,0));
for ( int i = 0; i < M; i++ ) {
int a,b;
cin >> a >> b;
P[a][b] = 1;
P[b][a] = 1;
}
int ans = 0;
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++ ) {
int x[4] = { a,b,c,d };
bool ok = true;
for ( int i = 0; i < 4; i++ ) {
int y = 0;
for ( int j = 0; j < 4; j++ ) {
if ( P[x[i]][x[j]] ) { y++; }
}
if ( y != 2 ) { ok = false; }
}
if ( ok ) { ans++; }
}
}
}
}
cout << ans << endl;
return 0;
}
tetsuzuki1115