結果
問題 | No.488 四角関係 |
ユーザー | anta |
提出日時 | 2017-02-24 22:26:25 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 56 ms / 5,000 ms |
コード長 | 1,125 bytes |
コンパイル時間 | 1,645 ms |
コンパイル使用メモリ | 167,676 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-30 23:21:08 |
合計ジャッジ時間 | 2,994 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
4,376 KB |
testcase_01 | AC | 17 ms
4,380 KB |
testcase_02 | AC | 25 ms
4,376 KB |
testcase_03 | AC | 9 ms
4,380 KB |
testcase_04 | AC | 14 ms
4,384 KB |
testcase_05 | AC | 31 ms
4,380 KB |
testcase_06 | AC | 56 ms
4,380 KB |
testcase_07 | AC | 56 ms
4,380 KB |
testcase_08 | AC | 56 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 | 4 ms
4,376 KB |
testcase_13 | AC | 6 ms
4,376 KB |
testcase_14 | AC | 2 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,380 KB |
testcase_16 | AC | 1 ms
4,380 KB |
testcase_17 | AC | 2 ms
4,380 KB |
testcase_18 | AC | 1 ms
4,380 KB |
testcase_19 | AC | 2 ms
4,380 KB |
testcase_20 | AC | 2 ms
4,380 KB |
testcase_21 | AC | 1 ms
4,380 KB |
testcase_22 | AC | 2 ms
4,376 KB |
testcase_23 | AC | 1 ms
4,380 KB |
testcase_24 | AC | 1 ms
4,380 KB |
ソースコード
#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll; template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; } template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; } int main() { int N; int M; while (~scanf("%d%d", &N, &M)) { bool g[50][50] = {}; rep(i, M) { int A; int B; scanf("%d%d", &A, &B); g[A][B] = g[B][A] = true; } int ans = 0; rep(i, N) rep(j, i) rep(k, j) rep(l, k) { int perm[4] = { i,j,k,l }; sort(perm, perm + 4); do { bool ok = true; rep(p, 4) { ok &= g[perm[p]][perm[(p + 1) % 4]]; ok &= !g[perm[p]][perm[(p + 2) % 4]]; } ans += ok; } while (next_permutation(perm, perm + 4)); } ans /= 8; printf("%d\n", ans); } return 0; }