結果

問題 No.488 四角関係
ユーザー syaro
提出日時 2017-03-03 20:08:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 718 bytes
コンパイル時間 2,216 ms
コンパイル使用メモリ 166,932 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-22 05:16:49
合計ジャッジ時間 2,117 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 6 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

signed main() {
    int N; cin >> N;
    int M; cin >> M;
    vector<set<int>> P(N);
    for(int i = 0; i < M; i++) {
        int a; cin >> a;
        int b; cin >> b;
        P[a].insert(b);
        P[b].insert(a);
    }
    int ans = 0;
    for(int i = 0; i < N; i++) for(int j: P[i]) if(i < j) for(int k: P[j]) if(i < k) {
        if(P[i].count(k)) continue;
        for(int l: P[k]) if(j < l) {
            if(not P[j].count(l) and P[i].count(l)) {
                if(-1) { //dbg
                    cout << i << ' ' << j << ' ' << k << ' ' << l << endl;
                }
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0