Submission #1948575


Source Code Expand

#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define INT_MAX_VALUE 2147483647
#define LONG_LONG_MAX_VALUE 9223372036854775807
#define ll long long

template <class T>
T mymax(T a,T b){
    if(a>=b) return a;
    return b;
}
template <class T>
T mymin(T a,T b){
    if(a<=b) return a;
    return b;
}

ll gcd(ll a, ll b){
    if(a<b){
        swap(a,b);
    }
    while(b){
        ll r = a%b;
        a=b;
        b=r;
    }
    return a;
}

ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

struct XX{
    long long x;
    long long jun;
    long long z;
    long long ix;
};

class xxGreater {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
        if((riLeft.x) == (riRight.x)){
            return riLeft.ix < riRight.ix;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
            //プライオリティキューの場合は > で、top()すると値の小さいものがとれる
        }
        //第1条件
        return (riLeft.x) < (riRight.x);
    }
};

//map<long long,long long> prime_f(long long n){
//    map<long long,long long>res;
//    for(int i=2;i*i<=n;i++){
//        while(n%i==0){
//            ++res[i];
//            n/=i;
//        }
//    }
//    if(n!=1)res[n]=1;
//    return res;
//}


int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //sscanf(tmp.c_str(),"%dd%d%d",&time[i], &dice[i], &z[i]);
    //getline(cin, target);
    //cin >> x >> y;
    //テスト用
    //ifstream ifs( "1_06.txt" );
    //ifs >> a;
    //ここから
    
    //入力高速化
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N,Y;
    cin >> N >> Y;
    
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++){
            if(N-i-j>=0 && 10000*i+5000*j+1000*(N-i-j)==Y){
                cout << i << " " << j << " " << N-i-j << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
    
    //ここまで
    //cout << "debug" << endl;
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

Submission Info

Submission Time
Task C - Otoshidama
User ikeha
Language C++14 (GCC 5.4.1)
Score 300
Code Size 2642 Byte
Status AC
Exec Time 5 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 24
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 5 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 5 ms 256 KB
b10 AC 5 ms 256 KB
b11 AC 5 ms 256 KB
b12 AC 1 ms 256 KB
b13 AC 1 ms 256 KB
b14 AC 1 ms 256 KB
b15 AC 5 ms 256 KB
b16 AC 4 ms 256 KB
b17 AC 4 ms 256 KB
b18 AC 1 ms 256 KB
b19 AC 1 ms 256 KB
b20 AC 1 ms 256 KB
b21 AC 5 ms 256 KB
b22 AC 4 ms 256 KB
b23 AC 4 ms 256 KB
b24 AC 4 ms 256 KB