Submission #19131811


Source Code Expand

#include <bits/stdc++.h>
#define rep(i, N) for(int i = 0; i < (int)N; i++)
#define CREP(i, l, r) for(int i = l; i <= r; i++)
using namespace std;
typedef long long ll;
typedef tuple<int,int,int> T; 
typedef pair<int,int> P;
typedef vector<int> V;
typedef vector<int> Vll;
const int INF = 1000000000;      //10^9, 2*INF
const ll LLINF = (1LL << 60);   // > 10^18 ll  2*LLINF

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    set<string> st;
    set<string> lst;
    rep(i, n) {
        cin >> s[i];
        st.insert(s[i]);
        if(s[i][0] == '!'){
            lst.insert(s[i].substr(1));
        }
    }

    bool f = false;
    string ans;
    auto itr = lst.begin();
    while(itr != lst.end()){
        auto titr = st.find(*itr);
        if(titr != st.end()){
            ans = *itr;
            f = true;
            break;
        }

        itr++;
    }


    if(f) cout << ans << "\n";
    else puts("satisfiable");
}

Submission Info

Submission Time
Task C - 1-SAT
User samari06
Language C++ (GCC 9.2.1)
Score 300
Code Size 990 Byte
Status AC
Exec Time 250 ms
Memory 33092 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 30
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All 01_small.txt, 02_small.txt, 03_small.txt, 04_small.txt, 05_small.txt, 06_small.txt, 07_small.txt, 08_small.txt, 09_small.txt, 10_small.txt, 11_small.txt, 12_small.txt, 13_small.txt, 14_small.txt, 15_small.txt, 16_satisfiable1.txt, 17_satisfiable2.txt, 18_unsatisfiable1.txt, 19_unsatisfiable1.txt, 20_unsatisfiable1.txt, 21_unsatisfiable1.txt, 22_unsatisfiable1.txt, 23_unsatisfiable1.txt, 24_unsatisfiable1.txt, 25_unsatisfiable1.txt, 26_unsatisfiable2.txt, 27_unsatisfiable2.txt, 28_same.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
01_small.txt AC 7 ms 3504 KiB
02_small.txt AC 2 ms 3568 KiB
03_small.txt AC 2 ms 3592 KiB
04_small.txt AC 2 ms 3612 KiB
05_small.txt AC 2 ms 3448 KiB
06_small.txt AC 2 ms 3560 KiB
07_small.txt AC 2 ms 3636 KiB
08_small.txt AC 2 ms 3576 KiB
09_small.txt AC 3 ms 3596 KiB
10_small.txt AC 2 ms 3420 KiB
11_small.txt AC 2 ms 3568 KiB
12_small.txt AC 2 ms 3488 KiB
13_small.txt AC 2 ms 3600 KiB
14_small.txt AC 2 ms 3592 KiB
15_small.txt AC 2 ms 3504 KiB
16_satisfiable1.txt AC 250 ms 33092 KiB
17_satisfiable2.txt AC 132 ms 11976 KiB
18_unsatisfiable1.txt AC 241 ms 33000 KiB
19_unsatisfiable1.txt AC 235 ms 32672 KiB
20_unsatisfiable1.txt AC 225 ms 32936 KiB
21_unsatisfiable1.txt AC 226 ms 32604 KiB
22_unsatisfiable1.txt AC 220 ms 32836 KiB
23_unsatisfiable1.txt AC 225 ms 33092 KiB
24_unsatisfiable1.txt AC 225 ms 33008 KiB
25_unsatisfiable1.txt AC 222 ms 33040 KiB
26_unsatisfiable2.txt AC 133 ms 11820 KiB
27_unsatisfiable2.txt AC 134 ms 11880 KiB
28_same.txt AC 65 ms 9448 KiB
sample_01.txt AC 2 ms 3500 KiB
sample_02.txt AC 3 ms 3424 KiB