제출 #940429

#제출 시각아이디문제언어결과실행 시간메모리
940429vjudge1수열 (BOI14_sequence)C++17
34 / 100
1008 ms98512 KiB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define pb              push_back
#define F               first
#define S               second
#define len(x)          (int)x.size()
#define all(x)          x.begin(),x.end()
#define file            freopen("connect.in", "r", stdin);freopen("connect.out", "w", stdout);
#define kill(x)         {cout << x << '\n'; continue;}
//#define int             long long
	
const int maxn = 1e7 + 5, LG = 20, MOD = 1e9+7;// 998244353
const ll inf =  1061109567;

//priority_queue< pii , vector<pii> , greater<pii> pq;

int n;
string a;
bool mark[maxn][10];

signed main() {
	ios::sync_with_stdio(0), cin.tie(0);

	for(int i = 1; i <= maxn; ++i) {	
		string s = to_string(i);
		for(auto j : s) mark[i][j - '0'] = true;
	}
	cin >> n;
	for(int i = 0; i < n; ++i) {int x; cin >> x; a += ((char) x + '0');}
	for(int i = 1; i <= maxn; ++i) {
		bool B = 1;
		for(int j = 0; j < n; ++j) {
			if(!mark[i+j][a[j] - '0']) { B = 0; break; }
		}
		if(B) {
			cout << i << '\n';
			break;
		}
	}
}

// hasan = nigga
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...