Submission #461035

# Submission time Handle Problem Language Result Execution time Memory
461035 2021-08-09T11:55:48 Z nonsensenonsense1 Saveit (IOI10_saveit) C++17
50 / 100
315 ms 12416 KB
#include "grader.h"
#include <cstring>
#include <vector>
#include <queue>

const int N = 1000;
int dist[N];
std::vector<int> g[N];

void encode(int n, int h, int p, int *a, int *b) 
{
	for (int i = 0; i < p; ++i) {
		g[a[i]].push_back(b[i]);
		g[b[i]].push_back(a[i]);
	}
	for (int i = 0; i < h; ++i) {
		memset(dist, -1, n << 2);
		std::queue<int> q;
		dist[i] = 0;
		q.push(i);
		while (!q.empty()) {
			int v = q.front();
			q.pop();
			for (int i = 0; i < (int)g[v].size(); ++i) if (dist[g[v][i]] == -1) {
				dist[g[v][i]] = dist[v] + 1;
				q.push(g[v][i]);
			}
		}
		for (int i = 0; i < n; ++i) for (int j = 0; j < 10; ++j) encode_bit(dist[i] >> j & 1);
	}
}
#include "grader.h"

void decode(int n, int h) 
{
	for (int i = 0; i < h; ++i) for (int j = 0; j < n; ++j) {
		int d = 0;
		for (int k = 0; k < 10; ++k) d |= decode_bit() << k;
		hops(i, j, d);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 315 ms 12416 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 2 ms 4580 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 71 ms 7272 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 4580 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 78 ms 7456 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 83 ms 7684 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 113 ms 8052 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 94 ms 7500 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 96 ms 7436 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 84 ms 7568 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 87 ms 7632 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 88 ms 7436 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 108 ms 8432 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 90 ms 7652 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 87 ms 7640 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 113 ms 7980 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 106 ms 7916 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 110 ms 8200 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 106 ms 7824 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 163 ms 8584 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 155 ms 8676 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 122 ms 8168 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 163 ms 9116 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 315 ms 12416 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 2 ms 4580 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 71 ms 7272 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 4580 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 78 ms 7456 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 83 ms 7684 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 113 ms 8052 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 94 ms 7500 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 96 ms 7436 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 84 ms 7568 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 87 ms 7632 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 88 ms 7436 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 108 ms 8432 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 90 ms 7652 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 87 ms 7640 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 113 ms 7980 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 106 ms 7916 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 110 ms 8200 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 106 ms 7824 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 163 ms 8584 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 155 ms 8676 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 122 ms 8168 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 163 ms 9116 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 315 ms 12416 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 2 ms 4580 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 71 ms 7272 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 4580 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 78 ms 7456 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 83 ms 7684 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 113 ms 8052 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 94 ms 7500 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 96 ms 7436 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 84 ms 7568 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 87 ms 7632 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 88 ms 7436 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 108 ms 8432 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 90 ms 7652 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 87 ms 7640 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 113 ms 7980 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 106 ms 7916 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 110 ms 8200 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 106 ms 7824 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 163 ms 8584 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 155 ms 8676 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 122 ms 8168 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 163 ms 9116 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 315 ms 12416 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 2 ms 4580 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 71 ms 7272 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 4580 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 78 ms 7456 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 83 ms 7684 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 113 ms 8052 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 94 ms 7500 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 96 ms 7436 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 84 ms 7568 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 87 ms 7632 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 88 ms 7436 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 108 ms 8432 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 90 ms 7652 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 87 ms 7640 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 113 ms 7980 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 106 ms 7916 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 110 ms 8200 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 106 ms 7824 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 163 ms 8584 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 155 ms 8676 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 122 ms 8168 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 163 ms 9116 KB Output is partially correct - 360000 call(s) of encode_bit()