Submission #7026516


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは 対数の底の変換を使う    log(N) / log(任意の底)

vector<int> L(8,0);                      // sum,a++,b++,c++,bool,a,b,c の8要素を参照渡しがめんどいので一か所にまとめておく。
void DFS(int i,int now,vector<int> &L){  // index,i番目ののお札,L
    if(i > N){
        if(L[0] == Y){  //L[0] == sum
            L[4] = 1; // true
            L[5] = L[1];    //a
            L[6] = L[2];    //b
            L[7] = L[3];    //c
            return;
        }
        else{
            return;
        }
    }

    L[0] += now;
    if(now == 10000)L[1]++;
    if(now == 5000)L[2]++;
    if(now == 1000)L[3]++;

    DFS(i+1,10000.L);
    DFS(i+1,5000,L);
    DFS(i+1,1000,L);
}


int main(){
    int N;cin >> N;
    LL Y;cin >> Y;
    DFS(1,10000,L);
    DFS(1,5000,L);
    DFS(1,1000,L);

    if(L[4])cout << L[5] << " " << L[6] << " " << L[7] << endl;
    else cout << -1 << " " << -1 << " " << -1 << endl; 
}

Submission Info

Submission Time
Task C - Otoshidama
User kerozou
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1571 Byte
Status CE

Compile Error

./Main.cpp: In function ‘void DFS(int, int, std::vector<int>&)’:
./Main.cpp:17:12: error: ‘N’ was not declared in this scope
     if(i > N){
            ^
./Main.cpp:18:20: error: ‘Y’ was not declared in this scope
         if(L[0] == Y){  //L[0] == sum
                    ^
./Main.cpp:35:20: error: too few arguments to function ‘void DFS(int, int, std::vector<int>&)’
     DFS(i+1,10000.L);
                    ^
./Main.cpp:16:6: note: declared here
 void DFS(int i,int now,vector<int> &L){  // index,i番目ののお札,L
      ^