Submission #448461

#TimeUsernameProblemLanguageResultExecution timeMemory
448461fuad27Palindrome-Free Numbers (BOI13_numbers)C++14
40.42 / 100
1100 ms296 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, n = 0, k = 0; while(s > 0) { if(s%10 == prev)return {n%(c/10) + 1, 1}; else if(s%10 == pprev)return {n%(c/100)+1, 1}; pprev = prev; prev = s%10; n+=s%10 * c; 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; }

Compilation message (stderr)

numbers.cpp: In function 'std::pair<long long int, bool> check(long long int)':
numbers.cpp:10:26: warning: unused variable 'k' [-Wunused-variable]
   10 |  long long c = 1, n = 0, k = 0;
      |                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...