Submission #751619

# Submission time Handle Problem Language Result Execution time Memory
751619 2023-06-01T01:58:35 Z Username4132 Ili (COI17_ili) C++14
49 / 100
4000 ms 12756 KB
#include<iostream>
#include<bitset>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)

const int MAXN=10010;
int n, m;
string info, ans;
bitset<MAXN> arr[MAXN], one("1"), nuli;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> info;
    ans.assign(m, '?');
    forn(i, m){
        char c1, c2;
        int a1, a2;
        cin >> c1 >> a1 >> c2 >> a2;
        --a1, --a2;
        bitset<MAXN> bi1 = c1=='x'? (one<<a1) : arr[a1];
        bitset<MAXN> bi2 = c2=='x'? (one<<a2) : arr[a2];
        arr[i]=bi1|bi2;
    }
    forn(i, m) if(info[i]=='0') nuli|=arr[i];
    nuli=~nuli;
    forn(i, m){
        arr[i]&=nuli;
        if(arr[i].count()==0) ans[i]='0';
    }
    forn(i, m) if(ans[i]!='0'){
        bool put=false;
        forn(j, m) if(info[j]=='1') put|=(arr[j] & arr[i])==arr[j];
        if(put) ans[i]='1';
    }
    cout << ans << endl;    
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 9 ms 928 KB Output is correct
9 Correct 2 ms 724 KB Output is correct
10 Correct 7 ms 852 KB Output is correct
11 Correct 6 ms 852 KB Output is correct
12 Correct 13 ms 896 KB Output is correct
13 Correct 9 ms 852 KB Output is correct
14 Correct 8 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 9 ms 928 KB Output is correct
9 Correct 2 ms 724 KB Output is correct
10 Correct 7 ms 852 KB Output is correct
11 Correct 6 ms 852 KB Output is correct
12 Correct 13 ms 896 KB Output is correct
13 Correct 9 ms 852 KB Output is correct
14 Correct 8 ms 852 KB Output is correct
15 Correct 2198 ms 7788 KB Output is correct
16 Correct 749 ms 9072 KB Output is correct
17 Correct 998 ms 10796 KB Output is correct
18 Correct 2421 ms 12628 KB Output is correct
19 Correct 1560 ms 9132 KB Output is correct
20 Correct 2658 ms 12500 KB Output is correct
21 Execution timed out 4070 ms 12756 KB Time limit exceeded
22 Halted 0 ms 0 KB -