Submission #1951065


Source Code Expand

/* code by AbhiTaker  */
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
#define M 1000000007
#define N 1000016
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define inf 9000000000000000000

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,i,y,x,z,p;
    cin>>n>>p;
    p /= 1000;

    p = p - n;
    if(n==p)
    {
       cout<<"0 0 "<<p<<"\n";
    }
    else if(p%4==0 && p/4<=n)
    {
        x = n - p/4;
        cout<<"0 "<<p/4<<" "<<x<<"\n";

    }
    else if(p%9==0 && p/9<= n)
    {
       x = n - p/9;
       cout<<p/9<<" 0 "<<x<<"\n";
    }
    else{
        ll f = 0;
        i=1;
        while(9*i + 4 < p)
        {
            if(p==9*i+4)
            {

                f = 1;
                break;
            }
            i++;
        }
        if(f)
        {
            x = n - i - 1;
            cout<<i<<" 1 "<<x<<"\n";
            return 0;
        }
        i = 1;
        while(9 + 4*i < p)
        {
            if(p==9 + 4*i)
            {
                f = 1;
                break;
            }
            i++;
        }
        if(f)
        {
            x = n - i - 1;
            cout<<" 1 "<<i<<" "<<x<<"\n";
            return 0;
        }
        cout<<"-1 -1 -1\n";
    }




    return 0;
}

Submission Info

Submission Time
Task C - Otoshidama
User AbhiTaker
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1494 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 17
WA × 7
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KB
a02 AC 1 ms 256 KB
a03 AC 1 ms 256 KB
a04 AC 1 ms 256 KB
b05 AC 1 ms 256 KB
b06 AC 1 ms 256 KB
b07 AC 1 ms 256 KB
b08 AC 1 ms 256 KB
b09 AC 1 ms 256 KB
b10 AC 1 ms 256 KB
b11 AC 1 ms 256 KB
b12 AC 1 ms 256 KB
b13 WA 1 ms 256 KB
b14 WA 1 ms 256 KB
b15 WA 1 ms 256 KB
b16 WA 1 ms 256 KB
b17 WA 1 ms 256 KB
b18 WA 1 ms 256 KB
b19 WA 1 ms 256 KB
b20 AC 1 ms 256 KB
b21 AC 1 ms 256 KB
b22 AC 1 ms 256 KB
b23 AC 1 ms 256 KB
b24 AC 1 ms 256 KB