Submission #448450

#TimeUsernameProblemLanguageResultExecution timeMemory
448450fuad27Palindrome-Free Numbers (BOI13_numbers)C++14
13.75 / 100
1099 ms276 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #define f first #define s second #define DEBUG(a, b) cerr<<a<<b; pair<long long, bool> check(long long s) { long long prev = -1, pprev = -2; long long c = 1; while(s > 0) { if(s%10 == prev)return {c/10, 1}; else if(s%10 == pprev)return {c/100, 1}; pprev = prev; prev = s%10; s/=10; c*=10; } return {1, 0}; } int main () { long long a, b, c = 0; cin >> a >> b; long long k = b-a; while(b >= a) { pair<long long, bool> k = check(b); if(k.s)c+=k.f; b-=k.f; } cout<<k - c+1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...