답안 #827749

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
827749 2023-08-16T17:14:47 Z tch1cherin 수열 (BOI14_sequence) C++17
34 / 100
609 ms 884 KB
#include <bits/stdc++.h>
using namespace std;

bool check(int n, int digit) {
  while (n > 0) {
    if (n % 10 == digit) {
      return true;
    }
    n /= 10;
  }
  return false;
}

int main() {
  int K;
  cin >> K;
  vector<int> B(K);
  for (int &v : B) {
    cin >> v;
  }
  for (int N = 1; N <= 1000; N++) {
    bool Good = true;
    for (int i = 0; i < K; i++) {
      Good &= check(N + i, B[i]);
    }
    if (Good) {
      cout << N << "\n";
      exit(0);
    }
  }
  const int MAX_N = 1e7;
  for (int N = 1, j = 1; N < MAX_N; N++) {
    j = max(j, N);
    while (j < MAX_N && check(j, B[0])) {
      j++;
    }
    if (j - N >= K) {
      cout << N << "\n";
      exit(0);
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 300 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 7 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 9 ms 308 KB Output is correct
15 Correct 9 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 4 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 296 KB Output is correct
2 Correct 53 ms 348 KB Output is correct
3 Correct 60 ms 344 KB Output is correct
4 Correct 53 ms 312 KB Output is correct
5 Correct 65 ms 348 KB Output is correct
6 Correct 39 ms 212 KB Output is correct
7 Correct 439 ms 692 KB Output is correct
8 Correct 242 ms 468 KB Output is correct
9 Correct 609 ms 884 KB Output is correct
10 Correct 603 ms 876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 450 ms 548 KB Output isn't correct
6 Halted 0 ms 0 KB -