Submission #1085609

# Submission time Handle Problem Language Result Execution time Memory
1085609 2024-09-08T13:20:03 Z I_am_Polish_Girl Maze (JOI23_ho_t3) C++14
51 / 100
2000 ms 1454024 KB
#pragma target("arch=icelake-server")

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack> 
#include <queue>
#include <cmath>
#include <random>
#include <chrono>
#include <iomanip>
#include <bitset>

using namespace std;


typedef long long ll;
typedef long double ld;

int log_ = 21;
int inf = 1000000007;

long long mod = 998244353;

int p = 499;

int NADIYA = 39;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int n, m, k;
	cin >> n >> m >> k;

	int i_st, j_st;
	cin >> i_st >> j_st;

	i_st--;
	j_st--;

	int i_f, j_f;
	cin >> i_f >> j_f;

	i_f--;
	j_f--;


	vector <int> deep;
	
	
	vector <string> vs(n);
	for (int i = 0; i < n; i++)
		cin >> vs[i];
	

	int X = 2;
	int c = 1;

	int sz = 0;

	int K = 2 * k - 1;

	
	while (c * X <= K)
	{
		c *= X;
		sz++;
	}

	sz++;

	vector <vector <vector<int>>> bin(n);

	vector <vector <int>> g(n*m*(2*sz));


	for (int i = 0; i < n; i++)
	{
		bin[i].resize(m);
		for (int j = 0; j < m; j++)
		{
			bin[i][j].resize(sz);
		}
	}

	int f = 0;

	vector <pair <int, int>> vp(n * m);


	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			bin[i][j][0] = f;
			
			vp[f] = { i , j };

			f++;
		}
	}

	int f2 = f;

	int y = 1;
	for (int k_ = 1; k_ < sz; k_ ++)
	{
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				bin[i][j][k_] = f;
				
				g[f].resize(X);

				for (int x = 0; x < X; x++)
				{
					g[f][x] = bin[i][min(j + y * x, m - 1)][k_ - 1];
				}
				
				f++;
			}
		}

		y *= X;
	}


	y /= X;



	vector <vector <vector<int>>> bin2(n);


	for (int i = 0; i < n; i++)
	{
		bin2[i].resize(m);
		for (int j = 0; j < m; j++)
		{
			bin2[i][j].resize(sz);
		}
	}


	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			bin2[i][j][0] = bin[i][j][0];
		}
	}

	y = 1;
	for (int k_ = 1; k_ < sz; k_++)
	{
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				bin2[i][j][k_] = f;

				g[f].resize(X);

				for (int x = 0; x < X; x++)
				{
					g[f][x] = bin2[min(i + y * x, n - 1)][j][k_ - 1];
				}

				f++;
			}
		}

		y *= X;
	}

	y /= X;






	deep.resize(g.size() ,inf);

	vector <vector < int>> q(2);

	for (int i = 0; i < 2; i++)
		q[i].resize(f);

	int f1_ = 0;
	int f2_ = 0;

	q[0][0] = bin[i_st][j_st][0];

	f1_ = 1;
	
	deep[bin[i_st][j_st][0]] = 0;

	vector <pair <int, int>> go;

	go.push_back({ 1 , 0 });
	go.push_back({ -1 , 0 });
	go.push_back({ 0 , 1 });
	go.push_back({ 0 , -1 });

	int d2 = -1;
	for (int d = 0 ; d < n*m+1  ; d ^= 1)
	{
		d2++;

		if (f1_ == 0)
			break;

		for (int ind = 0; ind < f1_; ind++)
		{
			int ind__ = q[d][ind];

			if (ind__ < f2)
			{
				int i_ = vp[ind__].first;
				int j_ = vp[ind__].second;

				for (int i = 0; i < 4; i++)
				{
					int i__ = i_ + go[i].first;
					int j__ = j_ + go[i].second;

					if ((i__ >= 0) and (i__ < n))
					{
						if ((j__ >= 0) and (j__ < m))
						{
							if (deep[bin[i__][j__][0]] > d2)
							{
								if (vs[i__][j__] == '.')
								{
									deep[bin[i__][j__][0]] = d2;

									q[d][f1_] = bin[i__][j__][0];
									f1_++;
								}
							}
						}
					}
				}
			}
			else
			{
				for (int i = 0; i < g[ind__].size(); i++)
				{
					int ind_s = g[ind__][i];

					if (deep[ind_s] > d2)
					{	
						deep[ind_s] = d2;
						
						q[d][f1_] = ind_s;
						f1_++;
					}
				}
			}
		}



		for (int ind = 0; ind < f1_; ind++)
		{
			int ind__ = q[d][ind];

			if (ind__ < f2)
			{
				int i_ = vp[ind__].first;
				int j_ = vp[ind__].second;


				if (i_ >= k) 
				{
					int l = j_ - (k - 1);
					int r = j_ + (k - 1);

					l = max(l, 0);
					r = min(r, m - 1);

					int i__ = i_ - k;
					int j__ = l;

					int lenth = r - l + 1;

					int c = 0;
					int x = 1;

					while (x * X <= lenth)
					{
						x *= X;
						c++;
					}

					for (int c_ = 0; c_ < (lenth / x); c_++)
					{
						if (deep[bin[i__][j__ + (c_ * x)][c]] == inf)
						{
							deep[bin[i__][j__ + (c_ * x)][c]] = d2 + 1;

							q[d ^ 1][f2_] = bin[i__][j__ + (c_ * x)][c];
							f2_++;
							//q[d + 1].push_back(bin[i__][j__ + (c_ * x)][c]);
						}
					}

					if (deep[bin[i__][r - x + 1][c]] == inf)
					{
						deep[bin[i__][r - x + 1][c]] = d2 + 1;
						
						q[d ^ 1][f2_] = bin[i__][r - x + 1][c];
						f2_++;

						//q[d + 1].push_back(bin[i__][r - x + 1][c]);
					}
					//q[d + 1].push_back(bin[i__][r - x+1][c]);
				}

				if (i_+ k < n) 
				{
					int l = j_ - (k - 1);
					int r = j_ + (k - 1);

					l = max(l, 0);
					r = min(r, m - 1);

					int i__ = i_ + k;
					int j__ = l;

					int lenth = r - l + 1;

					int c = 0;
					int x = 1;

					while (x * X <= lenth)
					{
						x *= X;
						c++;
					}

					for (int c_ = 0; c_ < (lenth / x); c_++)
					{
						if (deep[bin[i__][j__ + (c_ * x)][c]] == inf)
						{
							deep[bin[i__][j__ + (c_ * x)][c]] = d2 + 1;

							q[d ^ 1][f2_] = bin[i__][j__ + (c_ * x)][c];
							f2_++;
							//q[d + 1].push_back(bin[i__][j__ + (c_ * x)][c]);
						}
					}

					if (deep[bin[i__][r - x + 1][c]] == inf)
					{
						deep[bin[i__][r - x + 1][c]] = d2 + 1;

						q[d ^ 1][f2_] = bin[i__][r - x + 1][c];
						f2_++;

						//q[d + 1].push_back(bin[i__][r - x + 1][c]);
					}
					//q[d + 1].push_back(bin[i__][r - x+1][c]);
				}
				




				if (j_ >= k)
				{
					int l = i_ - (k - 1);
					int r = i_ + (k - 1);

					l = max(l, 0);
					r = min(r, n - 1);

					int i__ = l;
					int j__ = j_ - k;

					int lenth = r - l + 1;

					int c = 0;
					int x = 1;

					while (x * X <= lenth)
					{
						x *= X;
						c++;
					}

					for (int c_ = 0; c_ < (lenth / x); c_++)
					{
						if (deep[bin2[i__ + (c_ * x)][j__][c]] > d2 + 1)
						{
							deep[bin2[i__ + (c_ * x)][j__][c]] = d2 + 1;
							//q[d + 1].push_back(bin2[i__ + (c_ * x)][j__][c]);

							q[d ^ 1][f2_] = bin2[i__ + (c_ * x)][j__][c];
							f2_++;
						}
					}


					if (deep[bin2[r - x + 1][j__][c]] == inf)
					{
						deep[bin2[r - x + 1][j__][c]] = d2 + 1;
						//q[d + 1].push_back(bin2[r - x + 1][j__][c]);

						q[d ^ 1][f2_] = bin2[r - x + 1][j__][c];
						f2_++;
					}

					//q[d + 1].push_back(bin[l - x+1][j__][c]);
				}


				if (j_+k < m)
				{
					int l = i_ - (k - 1);
					int r = i_ + (k - 1);

					l = max(l, 0);
					r = min(r, n - 1);

					int i__ = l;
					int j__ = j_ + k;

					int lenth = r - l + 1;

					int c = 0;
					int x = 1;

					while (x * X <= lenth)
					{
						x *= X;
						c++;
					}

					for (int c_ = 0; c_ < (lenth / x); c_++)
					{
						if (deep[bin2[i__ + (c_ * x)][j__][c]] > d2 + 1)
						{
							deep[bin2[i__ + (c_ * x)][j__][c]] = d2 + 1;
							//q[d + 1].push_back(bin2[i__ + (c_ * x)][j__][c]);

							q[d ^ 1][f2_] = bin2[i__ + (c_ * x)][j__][c];
							f2_++;
						}
					}


					if (deep[bin2[r - x + 1][j__][c]] > d2 + 1)
					{
						deep[bin2[r - x + 1][j__][c]] = d2 + 1;
						//q[d + 1].push_back(bin2[r - x + 1][j__][c]);

						q[d ^ 1][f2_] = bin2[r - x + 1][j__][c];
						f2_++;
					}

					//q[d + 1].push_back(bin[l - x+1][j__][c]);
				}


			}
		}

		for (int i = 0; i < f2_; i++)
		{
			q[d][i] = q[d ^ 1][i];
		}

		f1_ = f2_;
		f2_ = 0;
	}


	//cout << deep[i_f][j_f] << "\n";

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if (abs(i - i_f) <= k)
			{
				if (abs(j - j_f) <= k)
				{
					if ((abs(i - i_f) + abs(j - j_f)) != 2 * k)
					{
						deep[bin[i_f][j_f][0]] = min(deep[bin[i_f][j_f][0]], deep[bin[i][j][0]] + 1);
					}
				}
			}
		}
	}

	cout << deep[bin[i_f][j_f][0]];
}

/*
5 5 2
2 2
4 4
#....
#.##.
####.
##...
.....
*/

Compilation message

Main.cpp:1: warning: ignoring '#pragma target ' [-Wunknown-pragmas]
    1 | #pragma target("arch=icelake-server")
      | 
Main.cpp: In function 'int main()':
Main.cpp:256:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  256 |     for (int i = 0; i < g[ind__].size(); i++)
      |                     ~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 14 ms 11100 KB Output is correct
20 Correct 8 ms 8792 KB Output is correct
21 Correct 16 ms 11120 KB Output is correct
22 Correct 14 ms 11096 KB Output is correct
23 Correct 13 ms 11264 KB Output is correct
24 Correct 11 ms 11100 KB Output is correct
25 Correct 10 ms 11100 KB Output is correct
26 Correct 14 ms 11316 KB Output is correct
27 Correct 14 ms 11164 KB Output is correct
28 Correct 13 ms 11100 KB Output is correct
29 Correct 33 ms 27612 KB Output is correct
30 Correct 11 ms 11352 KB Output is correct
31 Correct 34 ms 27484 KB Output is correct
32 Correct 38 ms 27484 KB Output is correct
33 Correct 35 ms 27484 KB Output is correct
34 Correct 23 ms 27620 KB Output is correct
35 Correct 22 ms 27624 KB Output is correct
36 Correct 43 ms 27484 KB Output is correct
37 Correct 45 ms 27552 KB Output is correct
38 Correct 33 ms 27484 KB Output is correct
39 Correct 579 ms 271956 KB Output is correct
40 Correct 41 ms 31320 KB Output is correct
41 Correct 29 ms 33756 KB Output is correct
42 Correct 58 ms 39248 KB Output is correct
43 Correct 46 ms 44120 KB Output is correct
44 Correct 182 ms 134804 KB Output is correct
45 Correct 196 ms 145392 KB Output is correct
46 Correct 441 ms 271956 KB Output is correct
47 Correct 635 ms 271956 KB Output is correct
48 Correct 558 ms 271948 KB Output is correct
49 Correct 241 ms 271860 KB Output is correct
50 Correct 264 ms 271932 KB Output is correct
51 Correct 654 ms 271956 KB Output is correct
52 Correct 626 ms 272104 KB Output is correct
53 Correct 570 ms 271956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 1 ms 1116 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 0 ms 604 KB Output is correct
32 Correct 0 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 860 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 2 ms 2140 KB Output is correct
25 Correct 19 ms 17252 KB Output is correct
26 Correct 37 ms 31572 KB Output is correct
27 Correct 11 ms 11380 KB Output is correct
28 Correct 71 ms 76628 KB Output is correct
29 Correct 71 ms 76848 KB Output is correct
30 Correct 61 ms 76636 KB Output is correct
31 Correct 57 ms 61012 KB Output is correct
32 Correct 17 ms 11388 KB Output is correct
33 Correct 14 ms 11352 KB Output is correct
34 Correct 173 ms 121936 KB Output is correct
35 Correct 29 ms 27740 KB Output is correct
36 Correct 188 ms 211796 KB Output is correct
37 Correct 176 ms 211756 KB Output is correct
38 Correct 175 ms 211628 KB Output is correct
39 Correct 613 ms 368828 KB Output is correct
40 Execution timed out 2072 ms 1454024 KB Time limit exceeded
41 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 1 ms 1116 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 0 ms 604 KB Output is correct
32 Correct 0 ms 604 KB Output is correct
33 Correct 13 ms 11356 KB Output is correct
34 Correct 3 ms 2140 KB Output is correct
35 Correct 2 ms 1628 KB Output is correct
36 Correct 18 ms 17244 KB Output is correct
37 Correct 7 ms 8792 KB Output is correct
38 Correct 36 ms 31648 KB Output is correct
39 Correct 11 ms 11352 KB Output is correct
40 Correct 13 ms 11300 KB Output is correct
41 Correct 11 ms 11352 KB Output is correct
42 Correct 64 ms 76628 KB Output is correct
43 Correct 60 ms 76620 KB Output is correct
44 Correct 62 ms 76624 KB Output is correct
45 Correct 9 ms 11356 KB Output is correct
46 Correct 10 ms 11372 KB Output is correct
47 Correct 16 ms 19212 KB Output is correct
48 Correct 41 ms 43088 KB Output is correct
49 Correct 50 ms 51292 KB Output is correct
50 Correct 52 ms 61080 KB Output is correct
51 Correct 53 ms 60916 KB Output is correct
52 Correct 14 ms 11356 KB Output is correct
53 Correct 14 ms 11608 KB Output is correct
54 Correct 13 ms 11356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 1 ms 1116 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 0 ms 604 KB Output is correct
32 Correct 0 ms 604 KB Output is correct
33 Correct 13 ms 11356 KB Output is correct
34 Correct 3 ms 2140 KB Output is correct
35 Correct 2 ms 1628 KB Output is correct
36 Correct 18 ms 17244 KB Output is correct
37 Correct 7 ms 8792 KB Output is correct
38 Correct 36 ms 31648 KB Output is correct
39 Correct 11 ms 11352 KB Output is correct
40 Correct 13 ms 11300 KB Output is correct
41 Correct 11 ms 11352 KB Output is correct
42 Correct 64 ms 76628 KB Output is correct
43 Correct 60 ms 76620 KB Output is correct
44 Correct 62 ms 76624 KB Output is correct
45 Correct 9 ms 11356 KB Output is correct
46 Correct 10 ms 11372 KB Output is correct
47 Correct 16 ms 19212 KB Output is correct
48 Correct 41 ms 43088 KB Output is correct
49 Correct 50 ms 51292 KB Output is correct
50 Correct 52 ms 61080 KB Output is correct
51 Correct 53 ms 60916 KB Output is correct
52 Correct 14 ms 11356 KB Output is correct
53 Correct 14 ms 11608 KB Output is correct
54 Correct 13 ms 11356 KB Output is correct
55 Correct 41 ms 27740 KB Output is correct
56 Correct 11 ms 11612 KB Output is correct
57 Correct 172 ms 121960 KB Output is correct
58 Correct 94 ms 61528 KB Output is correct
59 Correct 31 ms 27736 KB Output is correct
60 Correct 40 ms 27740 KB Output is correct
61 Correct 33 ms 27712 KB Output is correct
62 Correct 218 ms 211792 KB Output is correct
63 Correct 181 ms 211676 KB Output is correct
64 Correct 183 ms 211660 KB Output is correct
65 Correct 21 ms 27624 KB Output is correct
66 Correct 28 ms 27644 KB Output is correct
67 Correct 47 ms 47508 KB Output is correct
68 Correct 134 ms 127572 KB Output is correct
69 Correct 166 ms 152012 KB Output is correct
70 Correct 167 ms 152124 KB Output is correct
71 Correct 157 ms 171916 KB Output is correct
72 Correct 46 ms 27728 KB Output is correct
73 Correct 42 ms 27732 KB Output is correct
74 Correct 34 ms 27728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 14 ms 11100 KB Output is correct
20 Correct 8 ms 8792 KB Output is correct
21 Correct 16 ms 11120 KB Output is correct
22 Correct 14 ms 11096 KB Output is correct
23 Correct 13 ms 11264 KB Output is correct
24 Correct 11 ms 11100 KB Output is correct
25 Correct 10 ms 11100 KB Output is correct
26 Correct 14 ms 11316 KB Output is correct
27 Correct 14 ms 11164 KB Output is correct
28 Correct 13 ms 11100 KB Output is correct
29 Correct 33 ms 27612 KB Output is correct
30 Correct 11 ms 11352 KB Output is correct
31 Correct 34 ms 27484 KB Output is correct
32 Correct 38 ms 27484 KB Output is correct
33 Correct 35 ms 27484 KB Output is correct
34 Correct 23 ms 27620 KB Output is correct
35 Correct 22 ms 27624 KB Output is correct
36 Correct 43 ms 27484 KB Output is correct
37 Correct 45 ms 27552 KB Output is correct
38 Correct 33 ms 27484 KB Output is correct
39 Correct 579 ms 271956 KB Output is correct
40 Correct 41 ms 31320 KB Output is correct
41 Correct 29 ms 33756 KB Output is correct
42 Correct 58 ms 39248 KB Output is correct
43 Correct 46 ms 44120 KB Output is correct
44 Correct 182 ms 134804 KB Output is correct
45 Correct 196 ms 145392 KB Output is correct
46 Correct 441 ms 271956 KB Output is correct
47 Correct 635 ms 271956 KB Output is correct
48 Correct 558 ms 271948 KB Output is correct
49 Correct 241 ms 271860 KB Output is correct
50 Correct 264 ms 271932 KB Output is correct
51 Correct 654 ms 271956 KB Output is correct
52 Correct 626 ms 272104 KB Output is correct
53 Correct 570 ms 271956 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 604 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 604 KB Output is correct
63 Correct 0 ms 604 KB Output is correct
64 Correct 0 ms 604 KB Output is correct
65 Correct 1 ms 1116 KB Output is correct
66 Correct 1 ms 1116 KB Output is correct
67 Correct 1 ms 1116 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 0 ms 604 KB Output is correct
70 Correct 1 ms 600 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 860 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 1 ms 604 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 1 ms 600 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 0 ms 604 KB Output is correct
85 Correct 0 ms 604 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 604 KB Output is correct
93 Correct 1 ms 604 KB Output is correct
94 Correct 1 ms 1116 KB Output is correct
95 Correct 1 ms 1116 KB Output is correct
96 Correct 1 ms 1116 KB Output is correct
97 Correct 1 ms 604 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 860 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 604 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 604 KB Output is correct
107 Correct 1 ms 604 KB Output is correct
108 Correct 1 ms 604 KB Output is correct
109 Correct 2 ms 2140 KB Output is correct
110 Correct 19 ms 17252 KB Output is correct
111 Correct 37 ms 31572 KB Output is correct
112 Correct 11 ms 11380 KB Output is correct
113 Correct 71 ms 76628 KB Output is correct
114 Correct 71 ms 76848 KB Output is correct
115 Correct 61 ms 76636 KB Output is correct
116 Correct 57 ms 61012 KB Output is correct
117 Correct 17 ms 11388 KB Output is correct
118 Correct 14 ms 11352 KB Output is correct
119 Correct 173 ms 121936 KB Output is correct
120 Correct 29 ms 27740 KB Output is correct
121 Correct 188 ms 211796 KB Output is correct
122 Correct 176 ms 211756 KB Output is correct
123 Correct 175 ms 211628 KB Output is correct
124 Correct 613 ms 368828 KB Output is correct
125 Execution timed out 2072 ms 1454024 KB Time limit exceeded
126 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 14 ms 11100 KB Output is correct
20 Correct 8 ms 8792 KB Output is correct
21 Correct 16 ms 11120 KB Output is correct
22 Correct 14 ms 11096 KB Output is correct
23 Correct 13 ms 11264 KB Output is correct
24 Correct 11 ms 11100 KB Output is correct
25 Correct 10 ms 11100 KB Output is correct
26 Correct 14 ms 11316 KB Output is correct
27 Correct 14 ms 11164 KB Output is correct
28 Correct 13 ms 11100 KB Output is correct
29 Correct 33 ms 27612 KB Output is correct
30 Correct 11 ms 11352 KB Output is correct
31 Correct 34 ms 27484 KB Output is correct
32 Correct 38 ms 27484 KB Output is correct
33 Correct 35 ms 27484 KB Output is correct
34 Correct 23 ms 27620 KB Output is correct
35 Correct 22 ms 27624 KB Output is correct
36 Correct 43 ms 27484 KB Output is correct
37 Correct 45 ms 27552 KB Output is correct
38 Correct 33 ms 27484 KB Output is correct
39 Correct 579 ms 271956 KB Output is correct
40 Correct 41 ms 31320 KB Output is correct
41 Correct 29 ms 33756 KB Output is correct
42 Correct 58 ms 39248 KB Output is correct
43 Correct 46 ms 44120 KB Output is correct
44 Correct 182 ms 134804 KB Output is correct
45 Correct 196 ms 145392 KB Output is correct
46 Correct 441 ms 271956 KB Output is correct
47 Correct 635 ms 271956 KB Output is correct
48 Correct 558 ms 271948 KB Output is correct
49 Correct 241 ms 271860 KB Output is correct
50 Correct 264 ms 271932 KB Output is correct
51 Correct 654 ms 271956 KB Output is correct
52 Correct 626 ms 272104 KB Output is correct
53 Correct 570 ms 271956 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 604 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 604 KB Output is correct
63 Correct 0 ms 604 KB Output is correct
64 Correct 0 ms 604 KB Output is correct
65 Correct 1 ms 1116 KB Output is correct
66 Correct 1 ms 1116 KB Output is correct
67 Correct 1 ms 1116 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 0 ms 604 KB Output is correct
70 Correct 1 ms 600 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 860 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 1 ms 604 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 1 ms 600 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 0 ms 604 KB Output is correct
85 Correct 0 ms 604 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 604 KB Output is correct
93 Correct 1 ms 604 KB Output is correct
94 Correct 1 ms 1116 KB Output is correct
95 Correct 1 ms 1116 KB Output is correct
96 Correct 1 ms 1116 KB Output is correct
97 Correct 1 ms 604 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 860 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 604 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 604 KB Output is correct
107 Correct 1 ms 604 KB Output is correct
108 Correct 1 ms 604 KB Output is correct
109 Correct 2 ms 2140 KB Output is correct
110 Correct 19 ms 17252 KB Output is correct
111 Correct 37 ms 31572 KB Output is correct
112 Correct 11 ms 11380 KB Output is correct
113 Correct 71 ms 76628 KB Output is correct
114 Correct 71 ms 76848 KB Output is correct
115 Correct 61 ms 76636 KB Output is correct
116 Correct 57 ms 61012 KB Output is correct
117 Correct 17 ms 11388 KB Output is correct
118 Correct 14 ms 11352 KB Output is correct
119 Correct 173 ms 121936 KB Output is correct
120 Correct 29 ms 27740 KB Output is correct
121 Correct 188 ms 211796 KB Output is correct
122 Correct 176 ms 211756 KB Output is correct
123 Correct 175 ms 211628 KB Output is correct
124 Correct 613 ms 368828 KB Output is correct
125 Execution timed out 2072 ms 1454024 KB Time limit exceeded
126 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 14 ms 11100 KB Output is correct
20 Correct 8 ms 8792 KB Output is correct
21 Correct 16 ms 11120 KB Output is correct
22 Correct 14 ms 11096 KB Output is correct
23 Correct 13 ms 11264 KB Output is correct
24 Correct 11 ms 11100 KB Output is correct
25 Correct 10 ms 11100 KB Output is correct
26 Correct 14 ms 11316 KB Output is correct
27 Correct 14 ms 11164 KB Output is correct
28 Correct 13 ms 11100 KB Output is correct
29 Correct 33 ms 27612 KB Output is correct
30 Correct 11 ms 11352 KB Output is correct
31 Correct 34 ms 27484 KB Output is correct
32 Correct 38 ms 27484 KB Output is correct
33 Correct 35 ms 27484 KB Output is correct
34 Correct 23 ms 27620 KB Output is correct
35 Correct 22 ms 27624 KB Output is correct
36 Correct 43 ms 27484 KB Output is correct
37 Correct 45 ms 27552 KB Output is correct
38 Correct 33 ms 27484 KB Output is correct
39 Correct 579 ms 271956 KB Output is correct
40 Correct 41 ms 31320 KB Output is correct
41 Correct 29 ms 33756 KB Output is correct
42 Correct 58 ms 39248 KB Output is correct
43 Correct 46 ms 44120 KB Output is correct
44 Correct 182 ms 134804 KB Output is correct
45 Correct 196 ms 145392 KB Output is correct
46 Correct 441 ms 271956 KB Output is correct
47 Correct 635 ms 271956 KB Output is correct
48 Correct 558 ms 271948 KB Output is correct
49 Correct 241 ms 271860 KB Output is correct
50 Correct 264 ms 271932 KB Output is correct
51 Correct 654 ms 271956 KB Output is correct
52 Correct 626 ms 272104 KB Output is correct
53 Correct 570 ms 271956 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 604 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 604 KB Output is correct
63 Correct 0 ms 604 KB Output is correct
64 Correct 0 ms 604 KB Output is correct
65 Correct 1 ms 1116 KB Output is correct
66 Correct 1 ms 1116 KB Output is correct
67 Correct 1 ms 1116 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 0 ms 604 KB Output is correct
70 Correct 1 ms 600 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 860 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 1 ms 604 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 1 ms 600 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 0 ms 604 KB Output is correct
85 Correct 0 ms 604 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 604 KB Output is correct
93 Correct 1 ms 604 KB Output is correct
94 Correct 1 ms 1116 KB Output is correct
95 Correct 1 ms 1116 KB Output is correct
96 Correct 1 ms 1116 KB Output is correct
97 Correct 1 ms 604 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 860 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 604 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 604 KB Output is correct
107 Correct 1 ms 604 KB Output is correct
108 Correct 1 ms 604 KB Output is correct
109 Correct 2 ms 2140 KB Output is correct
110 Correct 19 ms 17252 KB Output is correct
111 Correct 37 ms 31572 KB Output is correct
112 Correct 11 ms 11380 KB Output is correct
113 Correct 71 ms 76628 KB Output is correct
114 Correct 71 ms 76848 KB Output is correct
115 Correct 61 ms 76636 KB Output is correct
116 Correct 57 ms 61012 KB Output is correct
117 Correct 17 ms 11388 KB Output is correct
118 Correct 14 ms 11352 KB Output is correct
119 Correct 173 ms 121936 KB Output is correct
120 Correct 29 ms 27740 KB Output is correct
121 Correct 188 ms 211796 KB Output is correct
122 Correct 176 ms 211756 KB Output is correct
123 Correct 175 ms 211628 KB Output is correct
124 Correct 613 ms 368828 KB Output is correct
125 Execution timed out 2072 ms 1454024 KB Time limit exceeded
126 Halted 0 ms 0 KB -