Submission #421883

# Submission time Handle Problem Language Result Execution time Memory
421883 2021-06-09T13:13:41 Z MetalPower Sequence (BOI14_sequence) C++14
9 / 100
5 ms 460 KB
#include <bits/stdc++.h>
using namespace std;

const int MX = 1e5 + 10, num = 1e4;
int K, arr[MX];

inline int check(int a, const int& b){
	while(a){
		if(a % 10 == b) return true;
		a /= 10;
	}
	return false;
}

inline void chmin(long long& a, long long b){
	if(b < a) a = b;
}

bool vis[10];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);

	cin >> K;

	for(int i = 0; i < K; i++) cin >> arr[i];

	long long mn = 1e18;

	for(int N = 1; N < num; N++){
		bool pos = true;
		for(int i = 0; i < K; i++){
			if(!check(N + i, arr[i])){
				pos = false; break;
			}
		}
		if(pos) chmin(mn, (long long) N);
	}

	cout << mn << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Incorrect 1 ms 204 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 5 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Incorrect 4 ms 460 KB Output isn't correct
6 Halted 0 ms 0 KB -