Submission #590266

# Submission time Handle Problem Language Result Execution time Memory
590266 2022-07-05T17:32:50 Z blue Snake Escaping (JOI18_snake_escaping) C++17
5 / 100
2000 ms 11196 KB
#include <iostream>
#include <vector>
using namespace std;

using vi = vector<int>;

int main()
{
	int L, Q;
	cin >> L >> Q;

	vi A((1<<L));
	for(int i = 0; i < (1<<L); i++)
	{
		char c;
		cin >> c;
		A[i] = c - '0';
	}

	for(int j = 0; j < Q; j++)
	{
		int res = 0;

		int mask = 0, test = 0;
		for(int b = L-1; b >= 0; b--)
		{
			char c;
			cin >> c;

			if(c == '0')
				test |= (1<<b);
			else if(c == '1')
			{
				mask |= (1<<b);
				test |= (1<<b);
			}
		}

		// cerr << test << ' ' << mask << '\n';

		for(int i = 0; i < (1<<L); i++)
		{
			if((i & test) == mask)
				res += A[i];
		}

		cout << res << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 304 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 308 KB Output is correct
4 Correct 4 ms 304 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 4 ms 212 KB Output is correct
7 Correct 3 ms 284 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 304 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 308 KB Output is correct
4 Correct 4 ms 304 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 4 ms 212 KB Output is correct
7 Correct 3 ms 284 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Execution timed out 2063 ms 11196 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 304 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 308 KB Output is correct
4 Correct 4 ms 304 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 4 ms 212 KB Output is correct
7 Correct 3 ms 284 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Execution timed out 2063 ms 11196 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 304 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 308 KB Output is correct
4 Correct 4 ms 304 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 4 ms 212 KB Output is correct
7 Correct 3 ms 284 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Execution timed out 2065 ms 5792 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 304 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 308 KB Output is correct
4 Correct 4 ms 304 KB Output is correct
5 Correct 4 ms 212 KB Output is correct
6 Correct 4 ms 212 KB Output is correct
7 Correct 3 ms 284 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Execution timed out 2063 ms 11196 KB Time limit exceeded
12 Halted 0 ms 0 KB -