Submission #940403

#TimeUsernameProblemLanguageResultExecution timeMemory
940403vjudge1Sequence (BOI14_sequence)C++17
9 / 100
1069 ms100696 KiB
/// ITNOG #include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using namespace std; constexpr int MOD = 1e9 + 7, N = 1e7 + 8, M = 1e6, SQ = 600, INF = 1e9 + 8, LGN = 22, mod = 998244353, P = 131113; bool mark[N][10]; int n, a[N]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); for (int i = 0; i < N; ++ i){ string s = to_string(i); for (char ch : s){ mark[i][ch-'0'] = true; } } cin >> n; for (int i = 0; i < N; ++ i){ cin >> a[i]; } for (int i = 1; i < N; ++ i){ bool ok = true; for (int j = 0; j < n; ++ j){ if (!mark[i+j][a[j]]){ ok = false; } } if (ok){ cout << i; return 0; } } cout << -1; } // Yesterday is history // Tomorrow is a mystery // but today is a gift // That is why it is called the present
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...