답안 #235704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235704 2020-05-29T12:28:28 Z Kalam Ili (COI17_ili) C++11
49 / 100
4000 ms 12672 KB
// KALAM
# include<bits/stdc++.h>

using namespace std;

const int N = 10000 + 77;
int n , m;
bitset < N > B[N] , P , I , E;
char S[N];
int main() {
   scanf("%d %d" , & n , & m);
   scanf("%s" , S + 1);
   for(int i = 1;i <= n;++ i)
      P[i] = 1 , I[i] = 1;
   for(int i = 1;i <= m;++ i) {
      int k = 2;
      while(k --) {
         char c;
         int x;
         scanf(" %c%d" , & c , & x);
         if(c == 'x') B[i][x] = 1;
         else B[i] |= B[x];
      }
      if(S[i] == '0')
         P = (P & (I ^ B[i]));
   }
   for(int i = 1;i <= m;++ i)
      B[i] &= P;
   for(int i = 1;i <= m;++ i)
      if(S[i] == '?')
         for(int j = 1;j <= m;++ j)
            if(i != j && S[j] == '1')
               if((B[i] & B[j]) == B[j])
                  S[i] = '1';
   for(int i = 1;i <= m;++ i)
      if(B[i] == E && S[i] == '?')
         S[i] = '0';
   for(int i = 1;i <= m;++ i)
      printf("%c" , S[i]);

   return 0;
}

Compilation message

ili.cpp: In function 'int main()':
ili.cpp:11:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d %d" , & n , & m);
    ~~~~~^~~~~~~~~~~~~~~~~~~~~
ili.cpp:12:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%s" , S + 1);
    ~~~~~^~~~~~~~~~~~~~
ili.cpp:20:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
          scanf(" %c%d" , & c , & x);
          ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 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 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 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 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 17 ms 896 KB Output is correct
9 Correct 7 ms 768 KB Output is correct
10 Correct 12 ms 896 KB Output is correct
11 Correct 15 ms 896 KB Output is correct
12 Correct 12 ms 896 KB Output is correct
13 Correct 12 ms 896 KB Output is correct
14 Correct 18 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 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 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 17 ms 896 KB Output is correct
9 Correct 7 ms 768 KB Output is correct
10 Correct 12 ms 896 KB Output is correct
11 Correct 15 ms 896 KB Output is correct
12 Correct 12 ms 896 KB Output is correct
13 Correct 12 ms 896 KB Output is correct
14 Correct 18 ms 1024 KB Output is correct
15 Correct 2552 ms 7892 KB Output is correct
16 Correct 2067 ms 9176 KB Output is correct
17 Correct 2906 ms 10904 KB Output is correct
18 Execution timed out 4051 ms 12672 KB Time limit exceeded
19 Halted 0 ms 0 KB -