# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
631262 | 2022-08-18T01:38:22 Z | uylulu | Palindrome-Free Numbers (BOI13_numbers) | C++14 | 1 ms | 340 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define ld long double #define endl "\n" const int N = 19; int dp[N + 1][12][12][2]; string s; int f(int pos,int i1,int i2,int tight) { if(pos == s.size()) return 1; if(dp[pos][i1][i2][tight] != -1) return dp[pos][i1][i2][tight]; int res = 0,lim = 9; if(tight) { lim = s[pos] - '0'; } for(int i = 0;i <= lim;i++) { if(i == i1 || i == i2) continue; int ns = 0; if(i == lim) ns = tight; res += f(pos + 1,i2,i,ns); } return dp[pos][i1][i2][tight] = res; } int help(int x) { s = to_string(x); memset(dp,-1,sizeof(dp)); return f(0,11,11,1); } signed main() { freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int a,b; cin>>a>>b; if(a == 0) { cout<<help(b)<<endl; } else { cout<<help(b) - help(a - 1)<<endl; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 340 KB | Output isn't correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | Incorrect | 0 ms | 340 KB | Output isn't correct |
4 | Incorrect | 1 ms | 340 KB | Output isn't correct |
5 | Incorrect | 0 ms | 340 KB | Output isn't correct |
6 | Incorrect | 0 ms | 340 KB | Output isn't correct |
7 | Incorrect | 0 ms | 340 KB | Output isn't correct |
8 | Incorrect | 0 ms | 340 KB | Output isn't correct |
9 | Incorrect | 0 ms | 340 KB | Output isn't correct |
10 | Incorrect | 0 ms | 340 KB | Output isn't correct |
11 | Incorrect | 1 ms | 340 KB | Output isn't correct |
12 | Incorrect | 1 ms | 340 KB | Output isn't correct |
13 | Incorrect | 0 ms | 340 KB | Output isn't correct |
14 | Incorrect | 0 ms | 340 KB | Output isn't correct |
15 | Incorrect | 0 ms | 340 KB | Output isn't correct |
16 | Incorrect | 1 ms | 340 KB | Output isn't correct |
17 | Incorrect | 0 ms | 340 KB | Output isn't correct |
18 | Incorrect | 1 ms | 340 KB | Output isn't correct |
19 | Incorrect | 1 ms | 340 KB | Output isn't correct |
20 | Incorrect | 1 ms | 340 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 340 KB | Output isn't correct |
2 | Incorrect | 0 ms | 340 KB | Output isn't correct |
3 | Incorrect | 0 ms | 340 KB | Output isn't correct |
4 | Incorrect | 0 ms | 340 KB | Output isn't correct |
5 | Incorrect | 0 ms | 340 KB | Output isn't correct |
6 | Incorrect | 0 ms | 340 KB | Output isn't correct |
7 | Incorrect | 1 ms | 340 KB | Output isn't correct |
8 | Incorrect | 0 ms | 340 KB | Output isn't correct |
9 | Incorrect | 1 ms | 340 KB | Output isn't correct |
10 | Incorrect | 0 ms | 340 KB | Output isn't correct |
11 | Incorrect | 1 ms | 340 KB | Output isn't correct |
12 | Incorrect | 1 ms | 340 KB | Output isn't correct |
13 | Incorrect | 1 ms | 340 KB | Output isn't correct |
14 | Incorrect | 0 ms | 340 KB | Output isn't correct |
15 | Incorrect | 1 ms | 296 KB | Output isn't correct |
16 | Incorrect | 1 ms | 340 KB | Output isn't correct |
17 | Incorrect | 1 ms | 340 KB | Output isn't correct |
18 | Incorrect | 0 ms | 340 KB | Output isn't correct |
19 | Incorrect | 0 ms | 340 KB | Output isn't correct |
20 | Incorrect | 1 ms | 340 KB | Output isn't correct |
21 | Incorrect | 0 ms | 340 KB | Output isn't correct |
22 | Incorrect | 0 ms | 340 KB | Output isn't correct |
23 | Incorrect | 0 ms | 340 KB | Output isn't correct |
24 | Incorrect | 1 ms | 340 KB | Output isn't correct |
25 | Incorrect | 0 ms | 340 KB | Output isn't correct |
26 | Incorrect | 0 ms | 340 KB | Output isn't correct |
27 | Incorrect | 0 ms | 340 KB | Output isn't correct |
28 | Incorrect | 1 ms | 340 KB | Output isn't correct |
29 | Incorrect | 1 ms | 212 KB | Output isn't correct |
30 | Incorrect | 0 ms | 340 KB | Output isn't correct |
31 | Incorrect | 1 ms | 340 KB | Output isn't correct |
32 | Incorrect | 1 ms | 340 KB | Output isn't correct |
33 | Incorrect | 1 ms | 340 KB | Output isn't correct |
34 | Incorrect | 0 ms | 340 KB | Output isn't correct |
35 | Incorrect | 1 ms | 340 KB | Output isn't correct |
36 | Incorrect | 1 ms | 340 KB | Output isn't correct |
37 | Incorrect | 0 ms | 340 KB | Output isn't correct |
38 | Incorrect | 1 ms | 340 KB | Output isn't correct |
39 | Incorrect | 0 ms | 340 KB | Output isn't correct |
40 | Incorrect | 0 ms | 340 KB | Output isn't correct |
41 | Incorrect | 1 ms | 340 KB | Output isn't correct |
42 | Incorrect | 1 ms | 340 KB | Output isn't correct |
43 | Incorrect | 1 ms | 340 KB | Output isn't correct |
44 | Incorrect | 0 ms | 340 KB | Output isn't correct |
45 | Incorrect | 1 ms | 340 KB | Output isn't correct |