結果

問題 No.3092 3-2-SAT
ユーザー hourenhouren
提出日時 2022-04-01 21:50:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 973 bytes
コンパイル時間 1,393 ms
コンパイル使用メモリ 173,052 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-04-30 13:44:58
合計ジャッジ時間 3,372 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 21 ms
6,944 KB
testcase_07 AC 31 ms
8,320 KB
testcase_08 AC 17 ms
6,944 KB
testcase_09 AC 23 ms
7,296 KB
testcase_10 AC 11 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<vector<int>> q(m,vector<int>(4));
    rep(i,m){
        rep(j,4) cin >> q[i][j];
        q[i][0]--;
        q[i][1]--;
    }
    vector<int> a = {1,2,3};
    do{
        bool ans = true;
        rep(i,m){
            if(a[q[i][0]]!=q[i][2] && a[q[i][1]]!=q[i][3]){
                ans = false;
                break;
            }
        }
        if(ans){
            rep(i,3) cout << a[i] << ' ';
            cout << '\n';
            return 0;
        }
    }while(next_permutation(all(a)));
    cout << -1 << '\n';
    return 0;
}
0