Submission #5993417


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,Y;
  cin >> N >> Y;

  bool ans = false;
  int a1=-1,a2=-1,a3=-1;

  for(int i=0; i<=N && i*10000 <= Y; i++){
    for(int j=0; j<=N && j*5000 <= Y; j++){
      for(int k=0; k<=N && k*1000 <= Y; k++){
        if(i*10000 + j*5000 + k*1000 == Y && i+j+k ==N){
          a1 = i; a2 = j; a3 = k;
          break;
        }
      }
    }
  }

  cout << a1 << ' ' << a2 << ' ' << a3 << endl;
}

Submission Info

Submission Time
Task ABC085C - Otoshidama
User maki68
Language C++14 (GCC 5.4.1)
Score 0
Code Size 475 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 a01, a02, a03, a04
All 0 / 300 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 1 ms 256 KB
a02 1 ms 256 KB
a03 31 ms 256 KB
a04
b05 1 ms 256 KB
b06 1 ms 256 KB
b07 1 ms 256 KB
b08 159 ms 256 KB
b09
b10 158 ms 256 KB
b11
b12 162 ms 256 KB
b13 145 ms 256 KB
b14 156 ms 256 KB
b15
b16
b17
b18 1 ms 256 KB
b19 4 ms 256 KB
b20
b21 160 ms 256 KB
b22 149 ms 256 KB
b23
b24