結果
| 問題 |
No.488 四角関係
|
| コンテスト | |
| ユーザー |
小指が強い人
|
| 提出日時 | 2016-02-13 13:11:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 665 bytes |
| コンパイル時間 | 588 ms |
| コンパイル使用メモリ | 75,556 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 06:14:06 |
| 合計ジャッジ時間 | 1,423 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <fstream>
#include <random>
#include <string>
using namespace std;
#define REP(i, x, n) for(int i = x; i < n; i++)
bool a[100][100] = {0};
bool isTriangle(int i, int j, int k, int l) {
return a[i][j] && a[j][k] && a[k][l] && a[l][i] && !a[i][k] && !a[j][l];
}
int main(int argc, char* argv[])
{
int n, m;
cin >> n >> m;
REP(i,0,m) {
int p, q;
cin >> p >> q;
a[p][q] = a[q][p] = true;
}
int res = 0;
REP(i,0,n)
REP(j,i+1,n)
REP(k,j+1,n)
REP(l,k+1,n) {
if(isTriangle(i, j, k, l)) res++;
else if(isTriangle(i, k, j, l)) res++;
else if(isTriangle(i, j, l, k)) res++;
}
cout << res << endl;
return 0;
}
小指が強い人