Submission #64590

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
645902018-08-05 01:01:45keko37Snake Escaping (JOI18_snake_escaping)C++14
100 / 100
1944 ms51616 KiB
#include<iostream>
#include<cstdio>
using namespace std;
const int MAXN = (1<<20) + 5;
int n, q, a, b, c, sol, mask, N, rev, count, i, j, tc;
char ss[MAXN];
char l[30], cc;
int val[MAXN], sum0[MAXN], sum1[MAXN], pc[MAXN];
int main () {
scanf("%d%d", &n, &q);
scanf("%s", ss);
for (i=0; i<(1<<n); i++) {
val[i] = ss[i] - '0';
pc[i] = pc[i - (i&-i)]+1;
sum0[i] = val[i];
}
for (int i=0; i<(1<<n); i++) {
sum1[i] = val[i ^ ((1<<n) - 1)];
}
for (i=0; i<n; i++) {
for (j=0; j<(1<<n); j++) {
if (j & (1<<i)) sum0[j] += sum0[j ^ (1<<i)];
if (j & (1<<i)) sum1[j] += sum1[j ^ (1<<i)];
}
}
for (tc=0; tc<q; tc++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

snake_escaping.cpp: In function 'int main()':
snake_escaping.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &q);
  ~~~~~^~~~~~~~~~~~~~~~
snake_escaping.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", ss);
  ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...