Submission #940398

# Submission time Handle Problem Language Result Execution time Memory
940398 2024-03-07T08:53:32 Z vjudge1 Sequence (BOI14_sequence) C++17
9 / 100
1000 ms 100432 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(NULL);
  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 233 ms 100084 KB Output is correct
2 Correct 223 ms 100120 KB Output is correct
3 Correct 220 ms 100300 KB Output is correct
4 Correct 224 ms 100320 KB Output is correct
5 Correct 224 ms 100296 KB Output is correct
6 Correct 222 ms 100180 KB Output is correct
7 Correct 234 ms 100432 KB Output is correct
8 Correct 232 ms 100304 KB Output is correct
9 Correct 231 ms 100080 KB Output is correct
10 Correct 235 ms 100212 KB Output is correct
11 Correct 226 ms 100176 KB Output is correct
12 Correct 236 ms 100380 KB Output is correct
13 Correct 225 ms 100176 KB Output is correct
14 Correct 225 ms 100184 KB Output is correct
15 Correct 233 ms 100372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 226 ms 100300 KB Output is correct
2 Correct 222 ms 100064 KB Output is correct
3 Correct 227 ms 100384 KB Output is correct
4 Correct 223 ms 100176 KB Output is correct
5 Correct 224 ms 100176 KB Output is correct
6 Correct 225 ms 100300 KB Output is correct
7 Correct 229 ms 100176 KB Output is correct
8 Correct 228 ms 100364 KB Output is correct
9 Correct 223 ms 100176 KB Output is correct
10 Correct 223 ms 100176 KB Output is correct
11 Execution timed out 1054 ms 100316 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 222 ms 100084 KB Output is correct
2 Correct 982 ms 100180 KB Output is correct
3 Execution timed out 1074 ms 100180 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 221 ms 100180 KB Output is correct
2 Correct 222 ms 100176 KB Output is correct
3 Correct 245 ms 100056 KB Output is correct
4 Correct 231 ms 100068 KB Output is correct
5 Execution timed out 1046 ms 100432 KB Time limit exceeded
6 Halted 0 ms 0 KB -