結果

問題 No.488 四角関係
ユーザー 小指が強い人小指が強い人
提出日時 2016-02-13 14:15:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 732 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 75,328 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 04:58:26
合計ジャッジ時間 1,666 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 3 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 4 ms
4,348 KB
testcase_08 AC 4 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 isSquare(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(isSquare(i, j, k, l)) res++;
         else if(isSquare(i, k, j, l)) res++;
         else if(isSquare(i, j, l, k)) res++;
       }
    cout << res << endl;
    return 0;
}
0