Submission #338680

#TimeUsernameProblemLanguageResultExecution timeMemory
338680limabeansSequence (BOI14_sequence)C++17
9 / 100
7 ms1004 KiB
#include <bits/stdc++.h> using namespace std; template<typename T> void out(T x) { cout << x << endl; exit(0); } #define watch(x) cout << (#x) << " is " << (x) << endl using ll = long long; const int maxn = 1e6 + 5; int n; vector<int> a; set<int> digits(int x) { set<int> res; while (x) { res.insert(x%10); x/=10; } return res; } bool test(int x) { for (int i=0; i<n; i++) { if (digits(x+i).count(a[i])) continue; return false; } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n; a.resize(n); for (int i=0; i<n; i++) { cin>>a[i]; } for (int i=1; i<=1002; i++) { if (test(i)) out(i); } assert(false); 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...