結果
問題 |
No.2560 A_1 < A_2 < ... < A_N
|
ユーザー |
|
提出日時 | 2023-12-07 20:15:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 146 ms / 2,000 ms |
コード長 | 718 bytes |
コンパイル時間 | 3,319 ms |
コンパイル使用メモリ | 169,644 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-27 02:20:04 |
合計ジャッジ時間 | 3,743 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 15 |
ソースコード
// C++ Program to find sum of Fibonacci numbers in // O(Log n) time. #include <bits/stdc++.h> using namespace std; const long long MAX = LLONG_MAX; // Driver program to test above function int main() { int t; cin>>t; while(t--){ long long n,x; cin>>n>>x; if(n == 1){ cout<<x<<"\n"; continue; } vector<long long >ans; long long sum = 0; for(long long i=1; i<=x; i++){ if(n == 1){ if(x-sum>ans.back()){ ans.push_back(x-sum); n--; } break; } sum+=i; ans.push_back(i); n--; } // cout<<ans.size()<<" " <<n<<endl; if(n){ cout<<-1<<"\n"; continue; } for(auto i: ans) cout<<i<<" "; cout<<"\n"; } }