# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
60308 | IvanC | Palindrome-Free Numbers (BOI13_numbers) | C++17 | 5 ms | 992 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;
typedef long long ll;
const int MAXL = 25;
const int MAXD = 12;
ll dp[MAXL][MAXD][MAXD][2][2];
vector<int> digitos;
int N;
ll A,B;
ll solve(int pos,int l1,int l2,int flag,int leading){
ll &ret = dp[pos][l1][l2][flag][leading];
if(ret != -1) return ret;
ret = 0;
if(pos == N){
ret = 1;
return ret;
}
int limite = 9;
if(flag) limite = digitos[pos];
for(int i = 0;i<=limite;i++){
if(leading == 1 && i == 0){
ret += solve(pos+1,l1,l2,flag && (i == limite),leading);
}
else{
if(l1 != i && l2 != i) ret += solve(pos+1,i,l1,flag && (i == limite), 0);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |