Submission #136383

# Submission time Handle Problem Language Result Execution time Memory
136383 2019-07-25T08:09:54 Z KLPP Snake Escaping (JOI18_snake_escaping) C++14
5 / 100
2000 ms 13280 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)
int answer[(1<<10)][(1<<10)];

int main(){
  int l,q;
  cin>>l>>q;
  string R;
  cin>>R;
  rep(i,0,(1<<10)){
    rep(j,0,(1<<10)){
      answer[i][j]=-1;
    }
  }
  while(q--){
    string s;
    cin>>s;
    int b,t;
    b=0;
    t=0;
    rep(i,0,l){
      if(s[i]=='1'){
	b+=(1<<(l-1-i));
	t+=(1<<(l-1-i));
      }
      if(s[i]=='?'){
	t+=(1<<(l-1-i));
      }
    }
    if(answer[b][t]!=-1)cout<<answer[b][t]<<endl;
    else{
      answer[b][t]=0;
      rep(i,0,(1<<l)){
	if(((i&b)==b) && ((i&t)==i)){
	  //cout<<b<<" "<<t<<" "<<i<<" "<<R[i]<<endl;
	  answer[b][t]+=R[i]-'0';
	}
      }
      cout<<answer[b][t]<<endl;
    }
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4472 KB Output is correct
2 Correct 10 ms 4416 KB Output is correct
3 Correct 12 ms 4476 KB Output is correct
4 Correct 12 ms 4472 KB Output is correct
5 Correct 11 ms 4472 KB Output is correct
6 Correct 11 ms 4472 KB Output is correct
7 Correct 11 ms 4472 KB Output is correct
8 Correct 9 ms 4472 KB Output is correct
9 Correct 9 ms 4472 KB Output is correct
10 Correct 10 ms 4472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4472 KB Output is correct
2 Correct 10 ms 4416 KB Output is correct
3 Correct 12 ms 4476 KB Output is correct
4 Correct 12 ms 4472 KB Output is correct
5 Correct 11 ms 4472 KB Output is correct
6 Correct 11 ms 4472 KB Output is correct
7 Correct 11 ms 4472 KB Output is correct
8 Correct 9 ms 4472 KB Output is correct
9 Correct 9 ms 4472 KB Output is correct
10 Correct 10 ms 4472 KB Output is correct
11 Execution timed out 2040 ms 13280 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4472 KB Output is correct
2 Correct 10 ms 4416 KB Output is correct
3 Correct 12 ms 4476 KB Output is correct
4 Correct 12 ms 4472 KB Output is correct
5 Correct 11 ms 4472 KB Output is correct
6 Correct 11 ms 4472 KB Output is correct
7 Correct 11 ms 4472 KB Output is correct
8 Correct 9 ms 4472 KB Output is correct
9 Correct 9 ms 4472 KB Output is correct
10 Correct 10 ms 4472 KB Output is correct
11 Execution timed out 2040 ms 13280 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4472 KB Output is correct
2 Correct 10 ms 4416 KB Output is correct
3 Correct 12 ms 4476 KB Output is correct
4 Correct 12 ms 4472 KB Output is correct
5 Correct 11 ms 4472 KB Output is correct
6 Correct 11 ms 4472 KB Output is correct
7 Correct 11 ms 4472 KB Output is correct
8 Correct 9 ms 4472 KB Output is correct
9 Correct 9 ms 4472 KB Output is correct
10 Correct 10 ms 4472 KB Output is correct
11 Runtime error 74 ms 12264 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 4472 KB Output is correct
2 Correct 10 ms 4416 KB Output is correct
3 Correct 12 ms 4476 KB Output is correct
4 Correct 12 ms 4472 KB Output is correct
5 Correct 11 ms 4472 KB Output is correct
6 Correct 11 ms 4472 KB Output is correct
7 Correct 11 ms 4472 KB Output is correct
8 Correct 9 ms 4472 KB Output is correct
9 Correct 9 ms 4472 KB Output is correct
10 Correct 10 ms 4472 KB Output is correct
11 Execution timed out 2040 ms 13280 KB Time limit exceeded
12 Halted 0 ms 0 KB -