Submission #105984

# Submission time Handle Problem Language Result Execution time Memory
105984 2019-04-16T03:51:33 Z xiaowuc1 Sequence (BOI14_sequence) C++14
34 / 100
908 ms 40076 KB
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef vector<vector<ll>> matrix;

const int MAX_N = 10000000;
short valid[MAX_N];

void gen(int x) {
	int y = x;
	while(y) {
		valid[x] |= 1 << (y%10);
		y /= 10;
	}
}

int l[100000];
int n;
void solve() {
	for(int i = 0; i < MAX_N; i++) gen(i);
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> l[i];
	}
	int ret = 1;
	while(true) {
		bool good = true;
		for(int i = 0; good && i < n; i++) {
			good = (valid[ret+i] & (1 << l[i]));
		}
		if(good) {
			cout << ret << endl;
			break;
		}
		ret++;
	}
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
	/*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
	*/
	solve();
}
# Verdict Execution time Memory Grader output
1 Correct 180 ms 19960 KB Output is correct
2 Correct 175 ms 19960 KB Output is correct
3 Correct 166 ms 19980 KB Output is correct
4 Correct 173 ms 19832 KB Output is correct
5 Correct 178 ms 19832 KB Output is correct
6 Correct 180 ms 19932 KB Output is correct
7 Correct 163 ms 20036 KB Output is correct
8 Correct 163 ms 20088 KB Output is correct
9 Correct 167 ms 20088 KB Output is correct
10 Correct 173 ms 19876 KB Output is correct
11 Correct 162 ms 19960 KB Output is correct
12 Correct 165 ms 19960 KB Output is correct
13 Correct 160 ms 20040 KB Output is correct
14 Correct 183 ms 19916 KB Output is correct
15 Correct 190 ms 19960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 19836 KB Output is correct
2 Correct 178 ms 19908 KB Output is correct
3 Correct 179 ms 19960 KB Output is correct
4 Correct 167 ms 19984 KB Output is correct
5 Correct 172 ms 19904 KB Output is correct
6 Correct 171 ms 19856 KB Output is correct
7 Correct 169 ms 19992 KB Output is correct
8 Correct 184 ms 19892 KB Output is correct
9 Correct 163 ms 19984 KB Output is correct
10 Correct 161 ms 19960 KB Output is correct
11 Runtime error 908 ms 39672 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 167 ms 19988 KB Output is correct
2 Correct 173 ms 19964 KB Output is correct
3 Correct 577 ms 19940 KB Output is correct
4 Correct 179 ms 20088 KB Output is correct
5 Correct 637 ms 20088 KB Output is correct
6 Correct 176 ms 19972 KB Output is correct
7 Correct 286 ms 20476 KB Output is correct
8 Correct 651 ms 20348 KB Output is correct
9 Correct 425 ms 20576 KB Output is correct
10 Correct 484 ms 20624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 184 ms 19932 KB Output is correct
2 Correct 178 ms 20060 KB Output is correct
3 Correct 206 ms 19916 KB Output is correct
4 Correct 227 ms 19932 KB Output is correct
5 Runtime error 255 ms 40076 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -