Submission #940428

# Submission time Handle Problem Language Result Execution time Memory
940428 2024-03-07T09:08:24 Z vjudge1 Sequence (BOI14_sequence) C++17
34 / 100
1000 ms 237708 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 = 3e7 + 8, M = 1e6, SQ = 600, INF = 1e9 + 8, LGN = 22, mod = 998244353, P = 131113;

bitset <10> mark[N];
short int a[N];
int n;

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for(int i = 1; i < N; ++ i){
    mark[i][i%10] = true;
    mark[i] |= mark[i/10];
  }
  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;
        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 Correct 294 ms 235264 KB Output is correct
2 Correct 291 ms 235264 KB Output is correct
3 Correct 289 ms 235072 KB Output is correct
4 Correct 286 ms 235096 KB Output is correct
5 Correct 297 ms 235268 KB Output is correct
6 Correct 291 ms 235264 KB Output is correct
7 Correct 283 ms 235160 KB Output is correct
8 Correct 284 ms 235264 KB Output is correct
9 Correct 294 ms 235272 KB Output is correct
10 Correct 307 ms 235264 KB Output is correct
11 Correct 312 ms 235092 KB Output is correct
12 Correct 314 ms 235268 KB Output is correct
13 Correct 297 ms 235264 KB Output is correct
14 Correct 283 ms 235252 KB Output is correct
15 Correct 330 ms 235064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 286 ms 235088 KB Output is correct
2 Correct 286 ms 235092 KB Output is correct
3 Correct 286 ms 235088 KB Output is correct
4 Correct 286 ms 235268 KB Output is correct
5 Correct 312 ms 235348 KB Output is correct
6 Correct 383 ms 235092 KB Output is correct
7 Correct 291 ms 235264 KB Output is correct
8 Correct 290 ms 235136 KB Output is correct
9 Correct 317 ms 235164 KB Output is correct
10 Correct 289 ms 235192 KB Output is correct
11 Execution timed out 1082 ms 235056 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 294 ms 235092 KB Output is correct
2 Correct 285 ms 235088 KB Output is correct
3 Correct 504 ms 235296 KB Output is correct
4 Correct 287 ms 235092 KB Output is correct
5 Correct 542 ms 235344 KB Output is correct
6 Correct 299 ms 235088 KB Output is correct
7 Correct 356 ms 235312 KB Output is correct
8 Correct 521 ms 235360 KB Output is correct
9 Correct 423 ms 237392 KB Output is correct
10 Correct 514 ms 237504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 286 ms 235092 KB Output is correct
2 Correct 290 ms 235348 KB Output is correct
3 Correct 313 ms 235052 KB Output is correct
4 Correct 284 ms 235088 KB Output is correct
5 Correct 312 ms 235344 KB Output is correct
6 Correct 301 ms 235088 KB Output is correct
7 Correct 317 ms 235272 KB Output is correct
8 Correct 301 ms 235092 KB Output is correct
9 Correct 293 ms 235172 KB Output is correct
10 Correct 299 ms 235272 KB Output is correct
11 Correct 362 ms 237704 KB Output is correct
12 Correct 386 ms 237708 KB Output is correct
13 Correct 287 ms 235268 KB Output is correct
14 Execution timed out 1110 ms 235248 KB Time limit exceeded
15 Halted 0 ms 0 KB -