답안 #232797

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232797 2020-05-18T07:31:51 Z shayan_p Ili (COI17_ili) C++14
49 / 100
4000 ms 12664 KB
// Never let them see you bleed...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const int maxn = 1e4 + 10, mod = 1e9 + 7, inf = 1e9 + 10;

bitset<maxn> bs[maxn], zr, tmp;

int toInt(string s){
    stringstream ss;
    ss << s;
    int x;
    ss >> x;
    return x;
}
void inp(int i){
    string s;
    cin >> s;
    if(s[0] == 'c')
	bs[i] = bs[i] | bs[toInt(s.substr(1))-1];
    else
	bs[i][toInt(s.substr(1))-1] = 1;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie();

    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    for(int i = 0; i < m; i++){
	inp(i), inp(i);	
    }
    for(int i = 0; i < m; i++){
	if(s[i] == '0')
	    zr|= bs[i];
    }
    for(int i = 0; i < m; i++){
	tmp = zr & bs[i];
	if(tmp == bs[i])
	    s[i] = '0';
	bs[i] = bs[i] ^ tmp;
    }
    for(int i = 0; i < m; i++){
	bool bad = 0;
	if(s[i] == '?'){
	    for(int j = 0; j < m; j++){
		bad|= (s[j] == '1' && (bs[i] & bs[j]) == bs[j]);
	    }
	}
	if(bad)
	    s[i] = '1';
    }
    return cout << s << endl, 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 23 ms 896 KB Output is correct
9 Correct 8 ms 896 KB Output is correct
10 Correct 12 ms 968 KB Output is correct
11 Correct 14 ms 1024 KB Output is correct
12 Correct 12 ms 896 KB Output is correct
13 Correct 12 ms 1024 KB Output is correct
14 Correct 19 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 23 ms 896 KB Output is correct
9 Correct 8 ms 896 KB Output is correct
10 Correct 12 ms 968 KB Output is correct
11 Correct 14 ms 1024 KB Output is correct
12 Correct 12 ms 896 KB Output is correct
13 Correct 12 ms 1024 KB Output is correct
14 Correct 19 ms 1024 KB Output is correct
15 Correct 2127 ms 7896 KB Output is correct
16 Correct 1770 ms 9140 KB Output is correct
17 Correct 2404 ms 10868 KB Output is correct
18 Execution timed out 4075 ms 12664 KB Time limit exceeded
19 Halted 0 ms 0 KB -