Submission #421869

# Submission time Handle Problem Language Result Execution time Memory
421869 2021-06-09T13:08:14 Z Drew_ Sequence (BOI14_sequence) C++17
0 / 100
1 ms 332 KB
#include <iostream>
using namespace std;

const int MAX = 1069;

int n;
int ar[MAX];

inline bool yes(int num)
{
	for (int i = 0; i < n; ++i)
	{
		bool ok = false;
		int tmp = num + i;

		while (tmp)
		{
			if (tmp % 10 == ar[i]) { ok = true; break; }
			tmp /= 10;
		}

		if (!ok)
			return false;
	}
	return true;
}

int main()
{
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> ar[i];

	if (ar[0] <= 8)
	{
		int val[6] = {1, 10, 100, 1000, 10000, 100000};

		int id = -1;
		for (int i = 0; i < 6; ++i)
		{
			if (val[i] >= n)
			{
				id = i;
				break;
			}
		}
		if (ar[0] == 0) cout << 1;
		cout << ar[0];

		for (int i = 0; i < id; ++i)
			cout << 0;
		cout << '\n';
	}
	else
	{
		int val[6] = {1, 11, 111, 1111, 11111, 111111};

		int id = -1;
		for (int i = 0; i < 6; ++i)
		{
			if (val[i] >= n)
			{
				id = i;
				break;
			}
		}

		for (int i = 0; i < id; ++i)
			cout << 8;
		cout << 9 << '\n';
	}
	return 0;

	for (int i = 1;; ++i)
	{
		if (yes(i))
		{
			cout << i << '\n';
			break;
		}
	}


	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -