Submission #60308

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
603082018-07-24 01:01:53IvanCPalindrome-Free Numbers (BOI13_numbers)C++17
100 / 100
5 ms992 KiB
#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);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...