Submission #1948562
Source Code Expand
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <queue> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) //debug #define dump(x) cerr << #x << '=' << (x) << endl; #define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl; int main(){ int N; int Y; cin>>N>>Y; Y/=1000; REP(i,N+1){ REP(j,N+1){ int k=N-i-j; if(k<0){continue;} if(i+5*j+10*k==Y){ cout<<k<<" "<<j<<" "<<i<<endl; return 0; } // REP(k,N+1){ // if(i+j+k>N){continue;} // if(i+5*j+10*k==Y){ // cout<<i<<" "<<j<<" "<<k<<endl; // return 0; // } // } } } cout<<"-1 -1 -1"<<endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Otoshidama |
User | guruguru |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 2438 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 2 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 | 5 ms | 256 KB |
b09 | AC | 1 ms | 256 KB |
b10 | AC | 5 ms | 256 KB |
b11 | AC | 5 ms | 256 KB |
b12 | AC | 5 ms | 256 KB |
b13 | AC | 4 ms | 256 KB |
b14 | AC | 4 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 | 5 ms | 256 KB |
b22 | AC | 4 ms | 256 KB |
b23 | AC | 5 ms | 256 KB |
b24 | AC | 4 ms | 256 KB |