Submission #940105

# Submission time Handle Problem Language Result Execution time Memory
940105 2024-03-07T05:39:25 Z vjudge1 Sequence (BOI14_sequence) C++17
9 / 100
1000 ms 1000 KB
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define fast_io ios::sync_with_stdio(false);cin.tie(0);
#define what(x) cerr << #x << " is " << x << '\n';
#define kill(x) {cout << x << '\n'; return 0;}
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define pb push_back
#define ll long long
#define F first
#define S second
const ll inf = 1e16, mod = 1e9 + 7, delta = 1e9 + 9, SQ = 450, P = 6065621;

using namespace std;

const int N = 5e5 + 10, LG = 20;
deque<int> v;
int a[N], n;

inline bool check(ll t, int x) {
  while (t > 0) {
    if (t % 10 == x) 
      return true;
    t /= 10;
  }
  return false;
}

inline bool check (deque<int> x) {
  for (int i = 1; i <= n; i++) {
    int v = x.front();
    x.pop_front();
    if (!check(v, a[i])) return false;
  }
  return true;
}

int main () {
  fast_io;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  for (int i = 1; i <= n; i++)
    v.pb(i);
  int pt = n + 1;
  while (1) {
    if (check(v)) kill(pt - n);
    v.pop_front();
    v.pb(pt);
    ++pt;
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Execution timed out 1042 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 429 ms 580 KB Output is correct
3 Execution timed out 1056 ms 600 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Execution timed out 1071 ms 1000 KB Time limit exceeded
6 Halted 0 ms 0 KB -