Submission #545287

# Submission time Handle Problem Language Result Execution time Memory
545287 2022-04-04T07:32:13 Z MilosMilutinovic Snake Escaping (JOI18_snake_escaping) C++14
0 / 100
11 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
int n,q;
char s[1<<20],op[20];
int main(){
scanf("%d%d",&n,&q);
scanf("%s",s);
while(q--){
scanf("%s",op);
int ans=0;
for(int i=0;i<(1<<n);i++){
int ok=1;
for(int j=0;j<n;j++){
if(op[j]=='?')continue;
int b=((i>>j)&1);
if(b!=(int)(op[j]-'0'))ok=0;
}
if(ok==1)ans+=(int)(s[i]-'0');
}
printf("%d\n",ans);
}
return 0;
}

Compilation message

snake_escaping.cpp: In function 'int main()':
snake_escaping.cpp:6:6: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | scanf("%d%d",&n,&q);
      | ~~~~~^~~~~~~~~~~~~~
snake_escaping.cpp:7:6: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 | scanf("%s",s);
      | ~~~~~^~~~~~~~
snake_escaping.cpp:9:6: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 | scanf("%s",op);
      | ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -