Submission #814956


Source Code Expand

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))
#define rof(i,a,b) for(int (i)=(a);(i) > (b); --(i))
#define rep(i, c) for(auto &(i) : (c))
#define x first
#define y second
#define pb push_back
#define PB pop_back()
#define iOS ios_base::sync_with_stdio(false)
#define sqr(a) (((a) * (a)))
#define all(a) a.begin() , a.end()
#define error(x) cerr << #x << " = " << (x) <<endl
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define errop(a) cerr<<#a<<" = ( "<<((a).x)<<" , "<<((a).y)<<" )\n";
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define L(x) ((x)<<1)
#define R(x) (((x)<<1)+1)
#define umap unordered_map
#define double long double
typedef long long ll;
typedef pair<int,int>pii;
typedef vector<int> vi;
typedef complex<double> point;
template <typename T> using os =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>  inline void smax(T &x,T y){ x = max((x), (y));}
template <class T>  inline void smin(T &x,T y){ x = min((x), (y));}
const int maxn = 20;
bool b[maxn];
inline bool bad(int n){
	while(n){
		if(b[n % 10])	return true;
		n /= 10;
	}
	return false;
}
int main(){
	iOS;
	int n, k;
	cin >> n >> k;
	int a;
	while(k--){	cin >> a; b[a] = 1;}
	while(bad(n))	++ n;
	cout << n << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Iroha's Obsession
User amd
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1599 Byte
Status AC
Exec Time 4 ms
Memory 256 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status AC
AC × 10
Set Name Test Cases
Sample
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_X_01.txt, subtask1_X_02.txt, subtask1_X_03.txt, subtask1_X_04.txt, subtask1_X_05.txt, subtask1_X_06.txt, subtask1_X_07.txt, subtask1_X_08.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 4 ms 256 KiB
subtask0_sample_02.txt AC 4 ms 256 KiB
subtask1_X_01.txt AC 4 ms 256 KiB
subtask1_X_02.txt AC 4 ms 256 KiB
subtask1_X_03.txt AC 4 ms 256 KiB
subtask1_X_04.txt AC 4 ms 256 KiB
subtask1_X_05.txt AC 4 ms 256 KiB
subtask1_X_06.txt AC 4 ms 256 KiB
subtask1_X_07.txt AC 4 ms 256 KiB
subtask1_X_08.txt AC 4 ms 256 KiB