# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
579882 | RealSnake | Palindrome-Free Numbers (BOI13_numbers) | C++14 | 1 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define mod 1000000007
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll n;
string s;
ll dp[20][2][11][11][2];
ll solve(ll ind, bool b, ll lst1, ll lst2, bool zero) {
if(ind + 1 == n)
return 1;
if(dp[ind + 1][b][lst1][lst2][zero])
return dp[ind + 1][b][lst1][lst2][zero];
ll ans = 0;
if(b == 1) {
ll d = (s[ind + 1] - '0');
for(ll i = 0; i <= d; i++) {
if(!zero && (i == lst1 || i == lst2))
continue;
ans += solve(ind + 1, (i == d), i, lst1, (zero & (i == 0)));
}
}
else {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |