結果
問題 |
No.1090 ソーシャルディスタンス / Social Distance
|
ユーザー |
![]() |
提出日時 | 2020-06-24 21:44:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 674 bytes |
コンパイル時間 | 1,572 ms |
コンパイル使用メモリ | 168,260 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 20:21:22 |
合計ジャッジ時間 | 2,788 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 23 |
ソースコード
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n,d; cin >> n >> d; int* pa = new int[n]{0}; ll prev{ 0 }, cur{ 0 },l{ 0 }; ostringstream ss; ss << "0 "; for (int i = 1; i < n; ++i) { int ai; cin >> ai; if (prev + d >= l + ai) cur = prev + d; else cur = l + ai; char c[32]; sprintf(c, "%lld ", cur); ss << c; l += ai; prev = cur; } printf("%s", ss.str().replace(ss.str().length()-1,1,1,'\n').c_str()); delete[] pa; return 0; }