제출 #940237

#제출 시각아이디문제언어결과실행 시간메모리
940237NNNNN수열 (BOI14_sequence)C++17
9 / 100
488 ms13148 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; int n, a[N]; bool mark[N][11]; int main() { ios:: sync_with_stdio(0), cin.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int w = 1; w <= 1000000; w++) { string s = to_string(w); for (auto e : s) mark[w][e - '0'] = true; } for (int w = 1; w <= 1000000; w++) { int cnt = w; bool flag = true; for (int i = 0; i < n; i++) { if (i) cnt++; if (!mark[cnt][a[i]]) { flag = false; break; } } if (flag) { cout << w << '\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...