Submission #103435

# Submission time Handle Problem Language Result Execution time Memory
103435 2019-03-30T17:28:41 Z wilwxk Sequence (BOI14_sequence) C++11
0 / 100
570 ms 504 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN=1e5+5;
int v[MAXN];
int n;

bool procura(int val, int k) {
	while(val>10) {
		if(val%10==k) return 1;
		val/=10;
	}
	return val%10==k;
}

bool testa(int k) {
	for(int i=1; i<=n; i++) {
		int cur=k+i-1;
		if(!procura(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 i=1; i<=1e5; i++) {
		if(testa(i)) {
			printf("%d\n", i);
			return 0;
		}
	}
}

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 256 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 39 ms 504 KB Output is correct
3 Incorrect 570 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -