結果
問題 | No.115 遠足のおやつ |
ユーザー | wk1080id |
提出日時 | 2019-03-13 15:29:11 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,598 bytes |
コンパイル時間 | 684 ms |
コンパイル使用メモリ | 87,576 KB |
実行使用メモリ | 7,604 KB |
最終ジャッジ日時 | 2023-09-05 20:38:11 |
合計ジャッジ時間 | 10,181 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 348 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,376 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 1 ms
4,376 KB |
testcase_14 | AC | 2 ms
4,380 KB |
testcase_15 | AC | 113 ms
4,376 KB |
testcase_16 | AC | 27 ms
4,380 KB |
testcase_17 | AC | 2 ms
4,380 KB |
testcase_18 | AC | 1 ms
4,380 KB |
testcase_19 | AC | 1 ms
4,380 KB |
testcase_20 | AC | 1 ms
4,376 KB |
testcase_21 | AC | 2 ms
4,376 KB |
testcase_22 | AC | 1,946 ms
4,376 KB |
testcase_23 | AC | 3 ms
4,380 KB |
testcase_24 | TLE | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
ソースコード
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cctype> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define LINF (ll)INF*INF #define MOD 1000000007 #define rep(i,n) for(int i=0;i<(n);i++) #define loop(i,a,n) for(int i=a;i<(n);i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) #define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! typedef vector<int> vi; typedef vector<string> vs; typedef pair<int,int> pii; typedef vector<pii> vp; int gcd(int a, int b){ if(b==0) return a; return gcd(b,a%b); } int lcm(int a, int b){ return a/gcd(a,b)*b; } int n,d,k; vi ans; bool dfs(int i, int num, int sum){ if(sum == d && num == k){ //cout << "!" << endl; return true; } if(sum > d || i > n || num > k)return false; //cout << " " << i << " " << num << " " << sum << endl; if(dfs(i+1,num+1,sum+i)){ ans.push_back(i); return true; } if(dfs(i+1,num,sum)){ return true; } return false; } signed main(void) { cin >> n >> d >> k; rep(i,n){ if(dfs(i+1,0,0))break; } if(ans.size()){ sort(all(ans)); rep(i,ans.size()){ if(i)cout << " "; cout << ans[i]; } cout << endl; }else{ cout << -1 << endl; } }