Submission #720027

# Submission time Handle Problem Language Result Execution time Memory
720027 2023-04-07T09:32:37 Z dozer Snake Escaping (JOI18_snake_escaping) C++14
12 / 100
2000 ms 19044 KB
#include <bits/stdc++.h>
using namespace std;
#define sp " "
#define endl "\n";
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define N 200005
#define int long long

const int modulo = 1e9 + 7;


int arr[N];

int32_t main()
{
	fastio();

	int l, q;
	cin>>l>>q;
	for (int i = 0; i < (1<<l); i++)
	{
		char tmp;
		cin>>tmp;
		arr[i] = tmp - '0';
	}

	while(q--)
	{
		int s = 0, t = 0;
		for (int i = l - 1; i >= 0; i--)
		{
			char tmp;
			cin>>tmp;
			if (tmp == '?') t |= (1<<i);
			else if (tmp == '1') s |= (1<<i);
		}
		int ans = 0;
		for (int i = t; i != 0; i = (i - 1) & t)
			ans += arr[s | i];
		ans += arr[s];
		cout<<ans<<endl;
	}

	cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " seconds\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 293 ms 15076 KB Output is correct
12 Correct 353 ms 14924 KB Output is correct
13 Correct 297 ms 13916 KB Output is correct
14 Correct 308 ms 14052 KB Output is correct
15 Correct 364 ms 15072 KB Output is correct
16 Correct 320 ms 14200 KB Output is correct
17 Correct 331 ms 14284 KB Output is correct
18 Correct 1155 ms 16148 KB Output is correct
19 Correct 263 ms 13028 KB Output is correct
20 Correct 332 ms 14724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 293 ms 15076 KB Output is correct
12 Correct 353 ms 14924 KB Output is correct
13 Correct 297 ms 13916 KB Output is correct
14 Correct 308 ms 14052 KB Output is correct
15 Correct 364 ms 15072 KB Output is correct
16 Correct 320 ms 14200 KB Output is correct
17 Correct 331 ms 14284 KB Output is correct
18 Correct 1155 ms 16148 KB Output is correct
19 Correct 263 ms 13028 KB Output is correct
20 Correct 332 ms 14724 KB Output is correct
21 Correct 470 ms 16396 KB Output is correct
22 Correct 522 ms 18124 KB Output is correct
23 Correct 409 ms 17244 KB Output is correct
24 Correct 372 ms 17096 KB Output is correct
25 Correct 576 ms 19044 KB Output is correct
26 Correct 391 ms 17484 KB Output is correct
27 Correct 404 ms 17520 KB Output is correct
28 Execution timed out 2051 ms 5972 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Runtime error 6 ms 3924 KB Execution killed with signal 11
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 293 ms 15076 KB Output is correct
12 Correct 353 ms 14924 KB Output is correct
13 Correct 297 ms 13916 KB Output is correct
14 Correct 308 ms 14052 KB Output is correct
15 Correct 364 ms 15072 KB Output is correct
16 Correct 320 ms 14200 KB Output is correct
17 Correct 331 ms 14284 KB Output is correct
18 Correct 1155 ms 16148 KB Output is correct
19 Correct 263 ms 13028 KB Output is correct
20 Correct 332 ms 14724 KB Output is correct
21 Correct 470 ms 16396 KB Output is correct
22 Correct 522 ms 18124 KB Output is correct
23 Correct 409 ms 17244 KB Output is correct
24 Correct 372 ms 17096 KB Output is correct
25 Correct 576 ms 19044 KB Output is correct
26 Correct 391 ms 17484 KB Output is correct
27 Correct 404 ms 17520 KB Output is correct
28 Execution timed out 2051 ms 5972 KB Time limit exceeded
29 Halted 0 ms 0 KB -