Submission #940400

# Submission time Handle Problem Language Result Execution time Memory
940400 2024-03-07T08:54:34 Z vjudge1 Sequence (BOI14_sequence) C++17
9 / 100
1000 ms 100564 KB
/// ITNOG

#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;

constexpr int MOD = 1e9 + 7, N = 1e7 + 8, M = 1e6, SQ = 600, INF = 1e9 + 8, LGN = 22, mod = 998244353, P = 131113;

bool mark[N][10];
int n, a[N];

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  for (int i = 0; i < N; ++ i){
    string s = to_string(i);
    for (char ch : s){
      mark[i][ch-'0'] = true;
    }
  }
  cin >> n;
  for (int i = 0; i < N; ++ i){
    cin >> a[i];
  }
  for (int i = 1; i < N; ++ i){
    bool ok = true;
    for (int j = 0; j < n; ++ j){
      if (!mark[i+j][a[j]]){
        ok = false;
      }
    }
    if (ok){
      cout << i;
      return 0;
    }
  }
  cout << -1;
}

// Yesterday is history
// Tomorrow is a mystery
// but today is a gift
// That is why it is called the present
# Verdict Execution time Memory Grader output
1 Correct 232 ms 100180 KB Output is correct
2 Correct 223 ms 100180 KB Output is correct
3 Correct 259 ms 100184 KB Output is correct
4 Correct 226 ms 100208 KB Output is correct
5 Correct 224 ms 100436 KB Output is correct
6 Correct 223 ms 100180 KB Output is correct
7 Correct 242 ms 100124 KB Output is correct
8 Correct 225 ms 100376 KB Output is correct
9 Correct 224 ms 100296 KB Output is correct
10 Correct 223 ms 100176 KB Output is correct
11 Correct 232 ms 100100 KB Output is correct
12 Correct 221 ms 100176 KB Output is correct
13 Correct 229 ms 100180 KB Output is correct
14 Correct 226 ms 100232 KB Output is correct
15 Correct 229 ms 100068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 222 ms 100444 KB Output is correct
2 Correct 248 ms 100300 KB Output is correct
3 Correct 223 ms 100084 KB Output is correct
4 Correct 226 ms 100564 KB Output is correct
5 Correct 221 ms 100332 KB Output is correct
6 Correct 224 ms 100180 KB Output is correct
7 Correct 239 ms 100152 KB Output is correct
8 Correct 223 ms 100176 KB Output is correct
9 Correct 226 ms 100128 KB Output is correct
10 Correct 226 ms 100212 KB Output is correct
11 Execution timed out 1041 ms 100180 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 233 ms 100296 KB Output is correct
2 Correct 986 ms 100204 KB Output is correct
3 Execution timed out 1073 ms 100092 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 234 ms 100068 KB Output is correct
2 Correct 228 ms 100176 KB Output is correct
3 Correct 244 ms 100336 KB Output is correct
4 Correct 226 ms 100060 KB Output is correct
5 Execution timed out 1036 ms 100308 KB Time limit exceeded
6 Halted 0 ms 0 KB -