Submission #235704

#TimeUsernameProblemLanguageResultExecution timeMemory
235704KalamIli (COI17_ili)C++11
49 / 100
4051 ms12672 KiB
// 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 (stderr)

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);
          ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...