Submission #41350

# Submission time Handle Problem Language Result Execution time Memory
41350 2018-02-16T18:16:35 Z gabrielsimoes Sequence (BOI14_sequence) C++14
9 / 100
1000 ms 1092 KB
#include <bits/stdc++.h>
using namespace std;

bool test(int a, int b) {
  while (a > 0) {
    if (b == (a % 10))
      return true;
    else
      a /= 10;
  }

  return false;
}

int n;
vector<int> v;

int main() {
  scanf("%d", &n);
  for (int i = 0, a; i < n; i++) {
    scanf("%d", &a);
    v.push_back(a);
  }

  for (int ans = 1; ans < 100000; ans++) {
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if (!test(ans + i, v[i])) ok = false;
    }

    if (ok) {
      printf("%d\n", ans);
      return 0;
    }
  }
}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:19:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
                  ^
sequence.cpp:21:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &a);
                    ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 248 KB Output is correct
2 Correct 6 ms 356 KB Output is correct
3 Correct 2 ms 432 KB Output is correct
4 Correct 3 ms 612 KB Output is correct
5 Correct 1 ms 612 KB Output is correct
6 Correct 1 ms 628 KB Output is correct
7 Correct 3 ms 628 KB Output is correct
8 Correct 11 ms 628 KB Output is correct
9 Correct 2 ms 628 KB Output is correct
10 Correct 5 ms 628 KB Output is correct
11 Correct 3 ms 628 KB Output is correct
12 Correct 2 ms 628 KB Output is correct
13 Correct 2 ms 628 KB Output is correct
14 Correct 17 ms 628 KB Output is correct
15 Correct 17 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 672 KB Output is correct
2 Correct 6 ms 672 KB Output is correct
3 Correct 2 ms 672 KB Output is correct
4 Correct 3 ms 700 KB Output is correct
5 Correct 2 ms 700 KB Output is correct
6 Correct 2 ms 700 KB Output is correct
7 Correct 103 ms 712 KB Output is correct
8 Correct 3 ms 712 KB Output is correct
9 Correct 14 ms 712 KB Output is correct
10 Correct 2 ms 712 KB Output is correct
11 Execution timed out 1056 ms 712 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 712 KB Output is correct
2 Execution timed out 1054 ms 712 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 712 KB Output is correct
2 Correct 6 ms 712 KB Output is correct
3 Correct 2 ms 712 KB Output is correct
4 Correct 3 ms 712 KB Output is correct
5 Execution timed out 1038 ms 1092 KB Time limit exceeded
6 Halted 0 ms 0 KB -