# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
579880 | 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][10][10];
ll solve(ll ind, bool b, ll lst1, ll lst2) {
if(ind + 1 == n)
return 1;
if(dp[ind + 1][b][lst1][lst2])
return dp[ind + 1][b][lst1][lst2];
ll ans = 0;
if(b == 1) {
ll d = (s[ind + 1] - '0');
for(ll i = 0; i <= d; i++) {
if(i == lst1 || i == lst2)
continue;
ans += solve(ind + 1, (i == d), i, lst1);
}
}
else {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |