Submission #1127415

#TimeUsernameProblemLanguageResultExecution timeMemory
1127415MuhammetSequence (BOI14_sequence)C++20
25 / 100
5 ms584 KiB
#include <bits/stdc++.h> using namespace std; int n; vector <int> a, b(105, 0), v; bool f(int x){ for(int i = 1; i <= n; i++){ int x1 = x; bool tr = 0; while(x1){ if(x1 % 10 == a[i]){ tr = 1; break; } x1 /= 10; } if(tr == 0) return false; x++; } return true; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n; a.resize(n); int mx = 0, mn = 1e9; for(int i = 0; i < n; i++){ cin >> a[i]; mn = min(mn, a[i]), mx = max(mx, a[i]); } if(mx != mn){ for(int i = 1; i <= 20000; i++){ if(f(i)){ cout << i; return 0; } } } if(a[0] == 0 or a[0] == 9){ int x = 1, k1 = 10, k2 = 8; while(x < n){ k1 *= 10; k2 *= 10; k2 += 8; x *= 10; x++; } if(a[0] == 0) cout << k1; else cout << k2+1; return 0; } int x = 1; while(x < n){ x *= 10; } x *= a[0]; cout << x; 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...