Submission #448450

# Submission time Handle Problem Language Result Execution time Memory
448450 2021-07-30T08:07:34 Z fuad27 Palindrome-Free Numbers (BOI13_numbers) C++14
13.75 / 100
1000 ms 276 KB
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define f first
#define s second
#define DEBUG(a, b) cerr<<a<<b;
pair<long long, bool> check(long long s) {
	long long prev = -1, pprev = -2;
	long long c = 1;
	while(s > 0) {
		if(s%10 == prev)return {c/10, 1};
		else if(s%10 == pprev)return {c/100, 1};
		pprev = prev;
		prev = s%10;
		s/=10;
		c*=10;
	}
	return {1, 0};
}
int main () {
	long long a, b, c = 0;
	cin >> a >> b;
	long long k = b-a;
	while(b >= a) {
		pair<long long, bool> k = check(b);
		if(k.s)c+=k.f;
		b-=k.f;
	}
	cout<<k - c+1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 2 ms 204 KB Output isn't correct
4 Incorrect 2 ms 204 KB Output isn't correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Incorrect 1 ms 204 KB Output isn't correct
14 Incorrect 2 ms 204 KB Output isn't correct
15 Incorrect 2 ms 204 KB Output isn't correct
16 Incorrect 0 ms 204 KB Output isn't correct
17 Incorrect 1 ms 204 KB Output isn't correct
18 Correct 1 ms 204 KB Output is correct
19 Incorrect 3 ms 204 KB Output isn't correct
20 Incorrect 2 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 264 KB Output isn't correct
2 Execution timed out 1093 ms 204 KB Time limit exceeded
3 Execution timed out 1091 ms 204 KB Time limit exceeded
4 Execution timed out 1090 ms 204 KB Time limit exceeded
5 Incorrect 662 ms 264 KB Output isn't correct
6 Incorrect 664 ms 272 KB Output isn't correct
7 Incorrect 32 ms 204 KB Output isn't correct
8 Incorrect 24 ms 204 KB Output isn't correct
9 Incorrect 42 ms 204 KB Output isn't correct
10 Incorrect 57 ms 272 KB Output isn't correct
11 Incorrect 69 ms 204 KB Output isn't correct
12 Incorrect 389 ms 204 KB Output isn't correct
13 Incorrect 89 ms 276 KB Output isn't correct
14 Incorrect 670 ms 264 KB Output isn't correct
15 Incorrect 777 ms 272 KB Output isn't correct
16 Execution timed out 1091 ms 204 KB Time limit exceeded
17 Incorrect 1 ms 204 KB Output isn't correct
18 Incorrect 1 ms 204 KB Output isn't correct
19 Incorrect 1 ms 204 KB Output isn't correct
20 Incorrect 1 ms 204 KB Output isn't correct
21 Execution timed out 1076 ms 204 KB Time limit exceeded
22 Incorrect 1 ms 204 KB Output isn't correct
23 Execution timed out 1078 ms 204 KB Time limit exceeded
24 Incorrect 1 ms 204 KB Output isn't correct
25 Execution timed out 1089 ms 204 KB Time limit exceeded
26 Execution timed out 1082 ms 204 KB Time limit exceeded
27 Execution timed out 1094 ms 204 KB Time limit exceeded
28 Execution timed out 1086 ms 204 KB Time limit exceeded
29 Incorrect 0 ms 204 KB Output isn't correct
30 Incorrect 0 ms 204 KB Output isn't correct
31 Execution timed out 1087 ms 204 KB Time limit exceeded
32 Incorrect 1 ms 204 KB Output isn't correct
33 Execution timed out 1099 ms 204 KB Time limit exceeded
34 Incorrect 1 ms 204 KB Output isn't correct
35 Execution timed out 1089 ms 204 KB Time limit exceeded
36 Execution timed out 1087 ms 204 KB Time limit exceeded
37 Execution timed out 1086 ms 204 KB Time limit exceeded
38 Execution timed out 1086 ms 204 KB Time limit exceeded
39 Execution timed out 1096 ms 204 KB Time limit exceeded
40 Incorrect 0 ms 204 KB Output isn't correct
41 Execution timed out 1090 ms 204 KB Time limit exceeded
42 Incorrect 0 ms 204 KB Output isn't correct
43 Execution timed out 1092 ms 204 KB Time limit exceeded
44 Execution timed out 1090 ms 204 KB Time limit exceeded
45 Execution timed out 1093 ms 204 KB Time limit exceeded