Submission #817359


Source Code Expand

Copy
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()
{
  int N, K;
  cin >> N >> K;

  vector<string> D(K);
  for(int i = 0; i < K; i++) {
    cin >> D[i];
  }

  for(int i = N; i < 10001; i++) {
    string s = to_string(i);
    bool fflag = true;
    bool flag;
    for(int j = 0; j < s.size(); j++) {
      flag = false;
      for(int k = 0; k < K; k++) {
	if(s[j] == D[k][0]) {flag = true; break;}
      }
      if(flag) {fflag = false; break;}
    }
    if(fflag) {cout << i << endl; return 0;}
  }

  cout << N << endl;

  return 0;
}

Submission Info

Submission Time
Task C - Iroha's Obsession
User gamera416
Language C++14 (GCC 5.4.1)
Score 0
Code Size 672 Byte
Status WA
Exec Time 6 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status AC
AC × 9
WA × 1
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 KB
subtask0_sample_02.txt AC 4 ms 256 KB
subtask1_X_01.txt AC 6 ms 256 KB
subtask1_X_02.txt WA 4 ms 256 KB
subtask1_X_03.txt AC 5 ms 256 KB
subtask1_X_04.txt AC 4 ms 256 KB
subtask1_X_05.txt AC 4 ms 256 KB
subtask1_X_06.txt AC 6 ms 256 KB
subtask1_X_07.txt AC 4 ms 256 KB
subtask1_X_08.txt AC 4 ms 256 KB