Submission #940435

# Submission time Handle Problem Language Result Execution time Memory
940435 2024-03-07T09:14:23 Z vjudge1 Sequence (BOI14_sequence) C++17
34 / 100
1000 ms 98532 KB
#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;
		}
	}
}

# Verdict Execution time Memory Grader output
1 Correct 183 ms 98384 KB Output is correct
2 Correct 166 ms 98068 KB Output is correct
3 Correct 169 ms 98132 KB Output is correct
4 Correct 165 ms 98128 KB Output is correct
5 Correct 164 ms 98128 KB Output is correct
6 Correct 169 ms 98132 KB Output is correct
7 Correct 166 ms 98184 KB Output is correct
8 Correct 168 ms 98384 KB Output is correct
9 Correct 166 ms 98128 KB Output is correct
10 Correct 165 ms 98128 KB Output is correct
11 Correct 168 ms 98312 KB Output is correct
12 Correct 165 ms 98028 KB Output is correct
13 Correct 165 ms 98260 KB Output is correct
14 Correct 166 ms 98132 KB Output is correct
15 Correct 165 ms 98132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 168 ms 98132 KB Output is correct
2 Correct 172 ms 98172 KB Output is correct
3 Correct 170 ms 98224 KB Output is correct
4 Correct 169 ms 98128 KB Output is correct
5 Correct 186 ms 98132 KB Output is correct
6 Correct 172 ms 98200 KB Output is correct
7 Correct 168 ms 98132 KB Output is correct
8 Correct 170 ms 98132 KB Output is correct
9 Correct 170 ms 98080 KB Output is correct
10 Correct 165 ms 98220 KB Output is correct
11 Execution timed out 1008 ms 98132 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 164 ms 98220 KB Output is correct
2 Correct 180 ms 98312 KB Output is correct
3 Correct 657 ms 98312 KB Output is correct
4 Correct 178 ms 98464 KB Output is correct
5 Correct 718 ms 98128 KB Output is correct
6 Correct 168 ms 98236 KB Output is correct
7 Correct 333 ms 98464 KB Output is correct
8 Correct 671 ms 98384 KB Output is correct
9 Correct 480 ms 98500 KB Output is correct
10 Correct 567 ms 98532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 174 ms 98176 KB Output is correct
2 Correct 167 ms 98128 KB Output is correct
3 Correct 169 ms 98196 KB Output is correct
4 Correct 172 ms 98208 KB Output is correct
5 Incorrect 199 ms 98384 KB Output isn't correct
6 Halted 0 ms 0 KB -