Submission #860779

#TimeUsernameProblemLanguageResultExecution timeMemory
860779EllinorSequence (BOI14_sequence)C++14
34 / 100
1034 ms600 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast,inline") // Ofast = O3,fast-math,allow-store-data-races,no-protect-parens #pragma GCC optimize ("unroll-loops") #pragma GCC target("bmi,bmi2,lzcnt,popcnt") // bit manipulation #pragma GCC target("movbe") // byte swap #pragma GCC target("aes,pclmul,rdrnd") // encryption #pragma GCC target("avx,avx2,f16c,fma,sse3,ssse3,sse4.1,sse4.2") typedef long long ll; #define rep(i, a, b) for (int i = (a); i < int(b); i++) typedef pair<ll, ll> pll; typedef pair<int, int> pii; #define pb push_back inline void fast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } ll INF = 1000000000; ll mod = 1e9 + 7; #define int ll #define float double // int K; vector<char> ks; int32_t main() { fast(); cin >> K; ks.assign(K, -1); bool same = true; rep(i,0,K) { cin >> ks[i]; if (ks[i] != ks[0]) same = false; } if (same) { ll nat = 1, at = 1; while (true) { if (at - nat == K) { cout << nat << "\n"; exit(0); } string sat = to_string(at); bool bat = false; rep(i,0,sat.size()) { if (sat[i] == ks[0]) { bat = true; break; } } if (!bat) nat = at + 1; at++; } } else { rep(n,1,10000000000) { bool nat = true; rep(at,0,K) { string sat = to_string(n + at); bool bat = false; rep(i,0,sat.size()) { if (sat[i] == ks[at]) { bat = true; break; } } nat = nat && bat; if (!nat) break; } if (nat) { cout << n << "\n"; exit(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...