Submission #201940

# Submission time Handle Problem Language Result Execution time Memory
201940 2020-02-12T21:21:00 Z luciocf Saveit (IOI10_saveit) C++14
50 / 100
291 ms 14224 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"

using namespace std;

const int maxn = 1e3+10;

static int dist[maxn][maxn];

static bool mark[maxn];

static vector<int> grafo[maxn];

void bfs(int x)
{
	queue<int> fila;

	fila.push(x), mark[x] = 1;

	while (!fila.empty())
	{
		int u = fila.front(); fila.pop();

		for (auto v: grafo[u])
		{
			if (!mark[v])
			{
				dist[x][v] = dist[x][u]+1, mark[v] = 1;
				fila.push(v);
			}
		}
	}
}

void encode(int n, int h, int m, int *a, int *b)
{
	for (int i = 1; i <= m; i++)
	{
		a[i-1]++, b[i-1]++;

		grafo[a[i-1]].push_back(b[i-1]);
		grafo[b[i-1]].push_back(a[i-1]);
	}

	for (int i = 1; i <= h; i++)
	{
		memset(mark, 0, sizeof mark);

		bfs(i);
	}

	for (int i = 1; i <= h; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			for (int b = 0; b < 10; b++)
				encode_bit((dist[i][j]&(1<<b)) > 0);
		}
	}
}
#include <bits/stdc++.h>
#include "grader.h"
#include "decoder.h"

using namespace std;

void decode(int n, int h)
{
	for (int i = 1; i <= h; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			int d = 0;

			for (int b = 0; b < 10; b++)
				d += decode_bit()*(1<<b);

			hops(i-1, j-1, d);
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 291 ms 14224 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 12 ms 4672 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 79 ms 7620 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 12 ms 4544 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 81 ms 7948 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 8000 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 102 ms 8380 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 88 ms 7876 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 89 ms 7872 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 96 ms 7872 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 105 ms 8104 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 89 ms 8000 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 110 ms 8644 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 95 ms 8004 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 94 ms 8224 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 109 ms 8456 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 105 ms 8388 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 115 ms 8512 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 96 ms 8368 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 126 ms 8772 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 137 ms 9156 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 112 ms 8548 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 143 ms 9272 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 291 ms 14224 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 12 ms 4672 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 79 ms 7620 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 12 ms 4544 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 81 ms 7948 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 8000 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 102 ms 8380 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 88 ms 7876 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 89 ms 7872 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 96 ms 7872 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 105 ms 8104 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 89 ms 8000 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 110 ms 8644 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 95 ms 8004 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 94 ms 8224 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 109 ms 8456 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 105 ms 8388 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 115 ms 8512 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 96 ms 8368 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 126 ms 8772 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 137 ms 9156 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 112 ms 8548 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 143 ms 9272 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 291 ms 14224 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 12 ms 4672 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 79 ms 7620 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 12 ms 4544 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 81 ms 7948 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 8000 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 102 ms 8380 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 88 ms 7876 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 89 ms 7872 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 96 ms 7872 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 105 ms 8104 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 89 ms 8000 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 110 ms 8644 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 95 ms 8004 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 94 ms 8224 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 109 ms 8456 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 105 ms 8388 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 115 ms 8512 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 96 ms 8368 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 126 ms 8772 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 137 ms 9156 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 112 ms 8548 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 143 ms 9272 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 291 ms 14224 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 12 ms 4672 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 79 ms 7620 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 12 ms 4544 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 81 ms 7948 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 8000 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 102 ms 8380 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 88 ms 7876 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 89 ms 7872 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 96 ms 7872 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 105 ms 8104 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 89 ms 8000 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 110 ms 8644 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 95 ms 8004 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 94 ms 8224 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 109 ms 8456 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 105 ms 8388 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 115 ms 8512 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 96 ms 8368 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 126 ms 8772 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 137 ms 9156 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 112 ms 8548 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 143 ms 9272 KB Output is partially correct - 360000 call(s) of encode_bit()