답안 #331783

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331783 2020-11-30T05:19:15 Z daniel920712 Snake Escaping (JOI18_snake_escaping) C++14
5 / 100
2000 ms 2424 KB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string.h>
#include <map>
#include <utility>
#include <algorithm>
#include <stack>
using namespace std;
char all[100005];
char tt[25];
int main()
{
    int N,M,ans,i,j,ok;
    scanf("%d %d",&N,&M);
    scanf("%s",all);
    while(M--)
    {
        scanf("%s",tt);
        ans=0;
        for(i=0;i<(1<<N);i++)
        {
            ok=1;

            for(j=0;j<N;j++)
            {
                if((((1<<(N-j-1))&i)&&tt[j]=='0')||((((1<<(N-j-1))&i))==0&&tt[j]=='1')) ok=0;
            }
            if(ok)
            {
                //printf("%d\n",i);
                ans+=all[i]-'0';
            }

        }
        printf("%d\n",ans);
    }

	return 0;
}

Compilation message

snake_escaping.cpp: In function 'int main()':
snake_escaping.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |     scanf("%d %d",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~
snake_escaping.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |     scanf("%s",all);
      |     ~~~~~^~~~~~~~~~
snake_escaping.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   20 |         scanf("%s",tt);
      |         ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 388 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 16 ms 364 KB Output is correct
4 Correct 16 ms 364 KB Output is correct
5 Correct 19 ms 364 KB Output is correct
6 Correct 17 ms 364 KB Output is correct
7 Correct 18 ms 364 KB Output is correct
8 Correct 25 ms 364 KB Output is correct
9 Correct 19 ms 364 KB Output is correct
10 Correct 18 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 388 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 16 ms 364 KB Output is correct
4 Correct 16 ms 364 KB Output is correct
5 Correct 19 ms 364 KB Output is correct
6 Correct 17 ms 364 KB Output is correct
7 Correct 18 ms 364 KB Output is correct
8 Correct 25 ms 364 KB Output is correct
9 Correct 19 ms 364 KB Output is correct
10 Correct 18 ms 364 KB Output is correct
11 Execution timed out 2086 ms 2424 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 388 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 16 ms 364 KB Output is correct
4 Correct 16 ms 364 KB Output is correct
5 Correct 19 ms 364 KB Output is correct
6 Correct 17 ms 364 KB Output is correct
7 Correct 18 ms 364 KB Output is correct
8 Correct 25 ms 364 KB Output is correct
9 Correct 19 ms 364 KB Output is correct
10 Correct 18 ms 364 KB Output is correct
11 Execution timed out 2086 ms 2424 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 388 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 16 ms 364 KB Output is correct
4 Correct 16 ms 364 KB Output is correct
5 Correct 19 ms 364 KB Output is correct
6 Correct 17 ms 364 KB Output is correct
7 Correct 18 ms 364 KB Output is correct
8 Correct 25 ms 364 KB Output is correct
9 Correct 19 ms 364 KB Output is correct
10 Correct 18 ms 364 KB Output is correct
11 Runtime error 2 ms 1388 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 388 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 16 ms 364 KB Output is correct
4 Correct 16 ms 364 KB Output is correct
5 Correct 19 ms 364 KB Output is correct
6 Correct 17 ms 364 KB Output is correct
7 Correct 18 ms 364 KB Output is correct
8 Correct 25 ms 364 KB Output is correct
9 Correct 19 ms 364 KB Output is correct
10 Correct 18 ms 364 KB Output is correct
11 Execution timed out 2086 ms 2424 KB Time limit exceeded
12 Halted 0 ms 0 KB -