結果

問題 No.488 四角関係
ユーザー CleyLCleyL
提出日時 2021-11-23 07:50:34
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 722 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 74,720 KB
実行使用メモリ 8,828 KB
最終ジャッジ日時 2023-09-07 08:58:25
合計ジャッジ時間 1,957 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
using namespace std;
struct l{
  int x,y;
};
int main(){
  int n,m;cin>>n>>m;
  vector<vector<int>> A(m,vector<int>(m));
  for(int i = 0; m > i; i++){
    int x,y;cin>>x>>y;
    A[x][y] = 1;
    A[y][x] = 1;
  }
  int ans = 0;
  for(int i = 0; n > i; i++){
    for(int j = i+1; n > j; j++){
      for(int k = j+1; n > k; k++){
        for(int l = k+1; n > l; l++){
         if(A[i][j] && A[j][k] && A[k][l] && A[l][i] && !A[i][k] && !A[j][l])ans++;
         if(A[i][k] && A[k][l] && A[l][j] && A[j][i] && !A[l][i] && !A[k][j])ans++;
         if(A[i][k] && A[k][j] && A[j][l] && A[l][i] && !A[i][j] && !A[k][l])ans++;
        }
      }
    }
  }
  cout << ans << endl;
}
0