Submission #398871

# Submission time Handle Problem Language Result Execution time Memory
398871 2021-05-04T21:35:35 Z faresbasbs Sequence (BOI14_sequence) C++14
0 / 100
1 ms 208 KB
#include <bits/stdc++.h>
using namespace std;
int n,arr[1001];

int ok(int a , int b){
	while(a){
		if(a%10 == b){
			return true;
		}
		a /= 10;
	}
	return false;
}

bool ok2(int val){
	int num = val;
	for(int i = 0 ; i < n ; i += 1){
		if(!ok(num,arr[i])){
			return 0;
		}
		num += 1;
	}
	return 1;
}

int main(){
	cin >> n;
	for(int i = 0 ; i < n ; i += 1){
		cin >> arr[i];
	}
	int val = max(arr[0],1);
	while(true){
		if(arr[0] == 9){
			int v2 = 0 , vv = val;
			while(vv){
				v2 = (10*v2+8);
				vv /= 10;
			}
			v2 += 1;
			if(ok2(v2)){
				cout << v2 << endl;
				return 0;
			}
		}
		if(ok2(val)){
			cout << val << endl;
			return 0;
		}
		val *= 10;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -