Submission #103511

# Submission time Handle Problem Language Result Execution time Memory
103511 2019-03-30T20:50:02 Z wilwxk Sequence (BOI14_sequence) C++11
9 / 100
4 ms 640 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN=5e3+3;
int v[MAXN];
int n;

bool acha(int val, int x) {
	while(val>=10) {
		if(val/10==x||val%10==x) return 1;
		val/=10;
	}
	return val==x;
}

bool testa(int k) {
	for(int i=1; i<=n; i++) {
		int cur=k+i-1;
		if(!acha(cur, v[i])) return 0;
	}
	return 1;
} 

int main() {
	scanf("%d", &n);
	for(int i=1; i<=n; i++) scanf("%d", &v[i]);

	for(int base=1; base<=MAXN; base++) {
		if(testa(base)) {
			printf("%d\n", base);
			break;
		}
	}


}

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
sequence.cpp:26:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=n; i++) scanf("%d", &v[i]);
                          ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Incorrect 3 ms 384 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Execution timed out 4 ms 256 KB Time limit exceeded (wall clock)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 428 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Runtime error 3 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -