Submission #940420

# Submission time Handle Problem Language Result Execution time Memory
940420 2024-03-07T09:05:45 Z vjudge1 Sequence (BOI14_sequence) C++17
0 / 100
249 ms 99204 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];
short int a[N];
int n;

signed main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for(int i = 1; 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] - '0']){
        ok = false;
        break;
      }
    }
    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 Incorrect 232 ms 99152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 249 ms 99156 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 229 ms 99184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 222 ms 99204 KB Output isn't correct
2 Halted 0 ms 0 KB -