#include <bits/stdc++.h>
#define pb push_back
#define s second
#define f first
#define ll long long
using namespace std;
ll p[25],x,last,last2,y;
signed main (){
ios_base::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
p[0] = 1;
for (int i = 1; i <= 18; i++)
p[i] = p[i - 1]*10LL;
ll a,b,ans=0;
cin>>a>>b;
for (ll i = a; i <= b; ){
x=0; last = -1; last2 = -1;
for (int j = 18; j >= 0; j--){
if (i < p[j]) continue;
y = (i/p[j])%10;
x = x*10 + y;
if (y == last || y == last2){
last = -1;
x = (x + 1)*p[j];
break;
}
last2 = last;
last = y;
}
if (last!=-1) ans++,i++;
else i = x;
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
7 ms |
308 KB |
Output is correct |
4 |
Execution timed out |
1097 ms |
204 KB |
Time limit exceeded |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 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 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Execution timed out |
1092 ms |
204 KB |
Time limit exceeded |
15 |
Correct |
3 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Execution timed out |
1098 ms |
204 KB |
Time limit exceeded |
19 |
Correct |
7 ms |
204 KB |
Output is correct |
20 |
Correct |
2 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
166 ms |
284 KB |
Output is correct |
2 |
Execution timed out |
1098 ms |
204 KB |
Time limit exceeded |
3 |
Execution timed out |
1099 ms |
204 KB |
Time limit exceeded |
4 |
Execution timed out |
1078 ms |
204 KB |
Time limit exceeded |
5 |
Execution timed out |
1097 ms |
204 KB |
Time limit exceeded |
6 |
Execution timed out |
1099 ms |
204 KB |
Time limit exceeded |
7 |
Correct |
62 ms |
204 KB |
Output is correct |
8 |
Correct |
45 ms |
292 KB |
Output is correct |
9 |
Correct |
83 ms |
304 KB |
Output is correct |
10 |
Correct |
122 ms |
284 KB |
Output is correct |
11 |
Correct |
176 ms |
292 KB |
Output is correct |
12 |
Correct |
786 ms |
292 KB |
Output is correct |
13 |
Correct |
179 ms |
204 KB |
Output is correct |
14 |
Execution timed out |
1092 ms |
204 KB |
Time limit exceeded |
15 |
Execution timed out |
1087 ms |
204 KB |
Time limit exceeded |
16 |
Execution timed out |
1078 ms |
204 KB |
Time limit exceeded |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
0 ms |
204 KB |
Output is correct |
20 |
Correct |
0 ms |
204 KB |
Output is correct |
21 |
Execution timed out |
1082 ms |
204 KB |
Time limit exceeded |
22 |
Correct |
0 ms |
204 KB |
Output is correct |
23 |
Execution timed out |
1084 ms |
204 KB |
Time limit exceeded |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Execution timed out |
1088 ms |
204 KB |
Time limit exceeded |
26 |
Execution timed out |
1090 ms |
204 KB |
Time limit exceeded |
27 |
Execution timed out |
1095 ms |
204 KB |
Time limit exceeded |
28 |
Execution timed out |
1096 ms |
204 KB |
Time limit exceeded |
29 |
Correct |
0 ms |
204 KB |
Output is correct |
30 |
Correct |
0 ms |
204 KB |
Output is correct |
31 |
Execution timed out |
1094 ms |
204 KB |
Time limit exceeded |
32 |
Correct |
0 ms |
204 KB |
Output is correct |
33 |
Execution timed out |
1094 ms |
204 KB |
Time limit exceeded |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Execution timed out |
1097 ms |
204 KB |
Time limit exceeded |
36 |
Execution timed out |
1096 ms |
204 KB |
Time limit exceeded |
37 |
Execution timed out |
1092 ms |
204 KB |
Time limit exceeded |
38 |
Execution timed out |
1095 ms |
204 KB |
Time limit exceeded |
39 |
Execution timed out |
1091 ms |
204 KB |
Time limit exceeded |
40 |
Correct |
0 ms |
204 KB |
Output is correct |
41 |
Execution timed out |
1083 ms |
204 KB |
Time limit exceeded |
42 |
Correct |
0 ms |
204 KB |
Output is correct |
43 |
Execution timed out |
1080 ms |
204 KB |
Time limit exceeded |
44 |
Execution timed out |
1089 ms |
204 KB |
Time limit exceeded |
45 |
Execution timed out |
1087 ms |
204 KB |
Time limit exceeded |