Submission #6979349


Source Code Expand

#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
typedef long long ll;

int main(){
	/*input*/
	int n;	cin >> n;
	ll Y;	cin >> Y;
	/*calculation*/
	bool flag = false;	//true:OK false:-1
	int x, y, z;
	for(x = 0; x <= n && !flag; x++){
		for(y = 0; y <= n && !flag; y++){
			for(z = 0; z <= n && !flag; z++){
				if(x + y + z == n && 10000*x + 5000*y + 1000*z == Y){
					flag = true;
					break;
				}
			}
			if(flag)break;
		}
		if(flag)break;
	}
	/*output*/
	if(flag){
		printf("%d %d %d\n", x, y, z);
	}else{
		printf("%d %d %d\n", -1, -1, -1);
	}
}

Submission Info

Submission Time
Task C - Otoshidama
User kamecha
Language C++14 (GCC 5.4.1)
Score 0
Code Size 615 Byte
Status TLE
Exec Time 2103 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
TLE × 1
AC × 13
TLE × 11
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 3 ms 256 KB
a04 TLE 2103 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 TLE 2103 ms 256 KB
b10 TLE 2103 ms 256 KB
b11 TLE 2103 ms 256 KB
b12 AC 1 ms 256 KB
b13 AC 6 ms 256 KB
b14 AC 9 ms 256 KB
b15 TLE 2103 ms 256 KB
b16 TLE 2103 ms 256 KB
b17 TLE 2103 ms 256 KB
b18 AC 1 ms 256 KB
b19 AC 3 ms 256 KB
b20 AC 3 ms 256 KB
b21 TLE 2103 ms 256 KB
b22 TLE 2103 ms 256 KB
b23 TLE 2103 ms 256 KB
b24 TLE 2103 ms 256 KB