Submission #545288

# Submission time Handle Problem Language Result Execution time Memory
545288 2022-04-04T07:34:18 Z MilosMilutinovic Snake Escaping (JOI18_snake_escaping) C++14
5 / 100
2000 ms 3048 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>>(n-j-1))&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 Correct 14 ms 224 KB Output is correct
2 Correct 13 ms 308 KB Output is correct
3 Correct 12 ms 320 KB Output is correct
4 Correct 11 ms 212 KB Output is correct
5 Correct 11 ms 316 KB Output is correct
6 Correct 13 ms 320 KB Output is correct
7 Correct 13 ms 212 KB Output is correct
8 Correct 11 ms 212 KB Output is correct
9 Correct 14 ms 292 KB Output is correct
10 Correct 13 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 224 KB Output is correct
2 Correct 13 ms 308 KB Output is correct
3 Correct 12 ms 320 KB Output is correct
4 Correct 11 ms 212 KB Output is correct
5 Correct 11 ms 316 KB Output is correct
6 Correct 13 ms 320 KB Output is correct
7 Correct 13 ms 212 KB Output is correct
8 Correct 11 ms 212 KB Output is correct
9 Correct 14 ms 292 KB Output is correct
10 Correct 13 ms 316 KB Output is correct
11 Execution timed out 2063 ms 3048 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 224 KB Output is correct
2 Correct 13 ms 308 KB Output is correct
3 Correct 12 ms 320 KB Output is correct
4 Correct 11 ms 212 KB Output is correct
5 Correct 11 ms 316 KB Output is correct
6 Correct 13 ms 320 KB Output is correct
7 Correct 13 ms 212 KB Output is correct
8 Correct 11 ms 212 KB Output is correct
9 Correct 14 ms 292 KB Output is correct
10 Correct 13 ms 316 KB Output is correct
11 Execution timed out 2063 ms 3048 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 224 KB Output is correct
2 Correct 13 ms 308 KB Output is correct
3 Correct 12 ms 320 KB Output is correct
4 Correct 11 ms 212 KB Output is correct
5 Correct 11 ms 316 KB Output is correct
6 Correct 13 ms 320 KB Output is correct
7 Correct 13 ms 212 KB Output is correct
8 Correct 11 ms 212 KB Output is correct
9 Correct 14 ms 292 KB Output is correct
10 Correct 13 ms 316 KB Output is correct
11 Execution timed out 2060 ms 2568 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 224 KB Output is correct
2 Correct 13 ms 308 KB Output is correct
3 Correct 12 ms 320 KB Output is correct
4 Correct 11 ms 212 KB Output is correct
5 Correct 11 ms 316 KB Output is correct
6 Correct 13 ms 320 KB Output is correct
7 Correct 13 ms 212 KB Output is correct
8 Correct 11 ms 212 KB Output is correct
9 Correct 14 ms 292 KB Output is correct
10 Correct 13 ms 316 KB Output is correct
11 Execution timed out 2063 ms 3048 KB Time limit exceeded
12 Halted 0 ms 0 KB -