結果

問題 No.488 四角関係
ユーザー CleyLCleyL
提出日時 2021-11-23 07:43:21
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 532 ms / 5,000 ms
コード長 1,022 bytes
コンパイル時間 670 ms
コンパイル使用メモリ 70,336 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-07 08:47:19
合計ジャッジ時間 3,501 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
struct l{
  int x,y;
};
int main(){
  int n,m;cin>>n>>m;
  vector<l> A(m);
  for(int i = 0; m > i; i++){
    cin>>A[i].x>>A[i].y;
  }
  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++){
          int mp[4];
          for(int i = 0; 4 > i ;i++){
            mp[i] = 0;
          }
          for(int x = 0; m > x; x++){
            if((A[x].x == i || A[x].x == j || A[x].x == k || A[x].x == l) && (A[x].y == i || A[x].y == j || A[x].y == k || A[x].y == l)){
              mp[0] += (A[x].x == i) + (A[x].y == i);
              mp[1] += (A[x].x == j) + (A[x].y == j);
              mp[2] += (A[x].x == k) + (A[x].y == k);
              mp[3] += (A[x].x == l) + (A[x].y == l);
            }
          }
          if(mp[0] == 2 && mp[0]  == mp[1] && mp[1] == mp[2] && mp[2] == mp[3]){
            ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;
}
0