Submission #421906

#TimeUsernameProblemLanguageResultExecution timeMemory
421906BertedSequence (BOI14_sequence)C++14
9 / 100
10 ms460 KiB
#include <iostream>

using namespace std;

int N, A[100001], ans = 0;

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	for (int i = 1; i <= 1000; i++)
	{
		for (int j = 0; j < N; j++)
		{
			int c = i + j;
			bool exist = 0;
			while (c) {exist |= (A[j] == c % 10); c /= 10;}
			if (!exist) {break;}
			else if (j == N - 1) {ans = i;}
		}
		if (ans) break;
	}
	cout << ans << "\n";
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...