Submission #1521435


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
ifstream in("file.in");
ofstream out("file.out");
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005
#define int long long

int x,cnt,f=1,s,t,y,z,q,D,g,pwr[15];
vector <int> c,p;


int rev(int x){
    int ans=0;
    vector <int> p;
    while(x) p.push_back(x%10),x/=10;
    for(int i : p) ans*=10,ans+=i;
    return ans;
}

int32_t main(){
    ios_base :: sync_with_stdio(0);
    pwr[0]=1;
    for(int i=1;i<=13;i++) pwr[i]=pwr[i-1]*10;
    cin >> D; x=D;
    while(x){
        if(x%10!=0) f=0;
        else if(f) cnt++,D/=10;
        if(!f) c.push_back(x%10);
        x/=10;
    }
    for(int i=0;i<=1;i++){
        s=c.size();
        if(s<2) continue;
        for(int j=0;j<pwr[s/2];j++){
            p.clear();
            x=j; z=0;
            for(int k=0;k<=s/2-1;k++){
                y=x%10+z; z=0;
                q=(c[k]+y);
                if(q>9) q-=10,z=1;
                p.push_back(q);
                x/=10;
            }
            if(!p[0]) continue;
            if(s%2){
                for(int i=0;i<=9;i++){
                    p.push_back(i); x=j; y=(s-1)/2;
                    for(int i=p.size()-1;i>=0;i--,y++) x+=p[i]*pwr[y];
                    if(rev(x)-x==D) g++;//cout << x << ' ' << j << '\n';
                    p.pop_back();
                }
            }
            else{
                x=j; y=s/2;
                for(int i=p.size()-1;i>=0;i--,y++) x+=p[i]*pwr[y];
                if(rev(x)-x==D) g++;//cout << x << ' ' << j << '\n';
            }
        }
        c.push_back(0);
    }
    if(cnt) g*=9,cnt--;
    while(cnt) g*=10,cnt--;
    cout << g;
}

Submission Info

Submission Time
Task F - Mirrored
User Rudy1000000007
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1947 Byte
Status WA
Exec Time 82 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 800
Status
AC × 3
AC × 46
WA × 17
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54, b55, b56, b57, b58, b59, b60, b61, b62, b63
Case Name Status Exec Time Memory
a01 AC 2 ms 384 KB
a02 AC 1 ms 256 KB
a03 AC 78 ms 256 KB
b04 AC 1 ms 256 KB
b05 WA 1 ms 256 KB
b06 AC 1 ms 256 KB
b07 WA 1 ms 256 KB
b08 AC 1 ms 256 KB
b09 AC 1 ms 256 KB
b10 WA 1 ms 256 KB
b11 AC 1 ms 256 KB
b12 AC 1 ms 256 KB
b13 WA 2 ms 256 KB
b14 WA 2 ms 256 KB
b15 AC 2 ms 256 KB
b16 AC 3 ms 256 KB
b17 AC 79 ms 256 KB
b18 WA 1 ms 256 KB
b19 WA 3 ms 256 KB
b20 WA 79 ms 256 KB
b21 WA 79 ms 256 KB
b22 WA 79 ms 256 KB
b23 WA 2 ms 256 KB
b24 AC 79 ms 256 KB
b25 WA 5 ms 256 KB
b26 AC 78 ms 256 KB
b27 AC 78 ms 256 KB
b28 AC 78 ms 256 KB
b29 AC 79 ms 256 KB
b30 WA 1 ms 256 KB
b31 AC 78 ms 256 KB
b32 AC 79 ms 256 KB
b33 WA 42 ms 256 KB
b34 AC 78 ms 256 KB
b35 WA 43 ms 256 KB
b36 AC 78 ms 256 KB
b37 AC 78 ms 256 KB
b38 AC 42 ms 256 KB
b39 AC 5 ms 256 KB
b40 AC 42 ms 256 KB
b41 WA 42 ms 256 KB
b42 WA 42 ms 256 KB
b43 AC 82 ms 384 KB
b44 AC 1 ms 256 KB
b45 AC 1 ms 256 KB
b46 AC 1 ms 256 KB
b47 AC 1 ms 256 KB
b48 AC 2 ms 256 KB
b49 AC 3 ms 256 KB
b50 AC 5 ms 256 KB
b51 AC 42 ms 256 KB
b52 AC 78 ms 256 KB
b53 AC 78 ms 256 KB
b54 AC 78 ms 256 KB
b55 AC 78 ms 256 KB
b56 AC 42 ms 256 KB
b57 AC 79 ms 256 KB
b58 AC 42 ms 256 KB
b59 AC 42 ms 256 KB
b60 AC 78 ms 256 KB
b61 AC 42 ms 256 KB
b62 AC 42 ms 256 KB
b63 AC 42 ms 256 KB