Submission #4064873


Source Code Expand

#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
typedef long long LL;
using namespace std;
typedef pair<int, int> Pii;
typedef pair<LL, LL> PLL;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int x = 0, y = 0, z = 0;
	int n, money;
	cin >> n >> money;
	int tmpn = n;
	y = money / 5000;
	for(int i = 0; i <= 20000; i++){
		for(int j = 0; j <= 4000; j++){
			LL l = money - ( 1000 * i + j * 5000);
			if(l < 0) break;
			if(!(l % 10000) && l/10000 + i + j == n){
				cout << l/10000  << ' ' << j  << ' ' << i << endl;
				return 0;
			}
		}
	}
	if(y == n){
		cout << x << ' ' << y << ' ' << z << endl;
		return 0;
	}
	cout << "-1" << ' ' << "-1" << ' ' << "-1" << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Otoshidama
User vjudge1
Language C++14 (GCC 5.4.1)
Score 300
Code Size 772 Byte
Status AC
Exec Time 60 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 1 ms 256 KB
b05 AC 1 ms 256 KB
b06 AC 1 ms 256 KB
b07 AC 1 ms 256 KB
b08 AC 2 ms 256 KB
b09 AC 1 ms 256 KB
b10 AC 2 ms 256 KB
b11 AC 60 ms 256 KB
b12 AC 2 ms 256 KB
b13 AC 2 ms 256 KB
b14 AC 2 ms 256 KB
b15 AC 1 ms 256 KB
b16 AC 1 ms 256 KB
b17 AC 1 ms 256 KB
b18 AC 1 ms 256 KB
b19 AC 1 ms 256 KB
b20 AC 2 ms 256 KB
b21 AC 2 ms 256 KB
b22 AC 2 ms 256 KB
b23 AC 58 ms 256 KB
b24 AC 55 ms 256 KB