Submission #208645

# Submission time Handle Problem Language Result Execution time Memory
208645 2020-03-12T00:37:39 Z E869120 Sequence (BOI14_sequence) C++14
34 / 100
1000 ms 98812 KB
#include <iostream>
using namespace std;

int N, A[1 << 18];
bool used[10000009][10];

void init() {
	for (int i = 0; i < 10000000; i++) {
		int cx = i;
		while (cx >= 1) {
			used[i][cx % 10] = true;
			cx /= 10;
		}
	}
}

bool check(int pos) {
	for (int i = 1; i <= N; i++) {
		if (used[pos][A[i]] == false) return false;
		pos++;
	}
	return true;
}

int main() {
	cin >> N; init();
	for (int i = 1; i <= N; i++) cin >> A[i];

	for (int i = 1; i <= 10000000; i++) {
		if (check(i) == true) {
			cout << i << endl;
			return 0;
		}
	}
	cout << "-1" << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 161 ms 98168 KB Output is correct
2 Correct 164 ms 98300 KB Output is correct
3 Correct 157 ms 98168 KB Output is correct
4 Correct 167 ms 98168 KB Output is correct
5 Correct 166 ms 98272 KB Output is correct
6 Correct 158 ms 98164 KB Output is correct
7 Correct 155 ms 98196 KB Output is correct
8 Correct 161 ms 98168 KB Output is correct
9 Correct 175 ms 98144 KB Output is correct
10 Correct 158 ms 98168 KB Output is correct
11 Correct 156 ms 98168 KB Output is correct
12 Correct 165 ms 98296 KB Output is correct
13 Correct 164 ms 98168 KB Output is correct
14 Correct 161 ms 98168 KB Output is correct
15 Correct 160 ms 98168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 162 ms 98168 KB Output is correct
2 Correct 159 ms 98204 KB Output is correct
3 Correct 163 ms 98172 KB Output is correct
4 Correct 171 ms 98296 KB Output is correct
5 Correct 159 ms 98168 KB Output is correct
6 Correct 164 ms 98168 KB Output is correct
7 Correct 162 ms 98296 KB Output is correct
8 Correct 157 ms 98200 KB Output is correct
9 Correct 166 ms 98168 KB Output is correct
10 Correct 164 ms 98168 KB Output is correct
11 Execution timed out 1032 ms 98168 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 164 ms 98168 KB Output is correct
2 Correct 168 ms 98168 KB Output is correct
3 Correct 733 ms 98424 KB Output is correct
4 Correct 169 ms 98168 KB Output is correct
5 Correct 796 ms 98460 KB Output is correct
6 Correct 159 ms 98168 KB Output is correct
7 Correct 341 ms 98560 KB Output is correct
8 Correct 732 ms 98552 KB Output is correct
9 Correct 533 ms 98812 KB Output is correct
10 Correct 648 ms 98808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 160 ms 98168 KB Output is correct
2 Correct 156 ms 98168 KB Output is correct
3 Correct 160 ms 98168 KB Output is correct
4 Correct 167 ms 98280 KB Output is correct
5 Incorrect 210 ms 98424 KB Output isn't correct
6 Halted 0 ms 0 KB -