Submission #208645

#TimeUsernameProblemLanguageResultExecution timeMemory
208645E869120Sequence (BOI14_sequence)C++14
34 / 100
1032 ms98812 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...