結果
問題 | No.1935 Water Simulation |
ユーザー |
|
提出日時 | 2022-05-27 20:48:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 2,145 ms |
コンパイル使用メモリ | 195,748 KB |
最終ジャッジ日時 | 2025-01-29 15:41:39 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { vector<int> c(4); for (int &x : c) cin >> x; int n; cin >> n; vector<int> a(4); a[0] = c[0]; if (n >= 396) n = n % 4 + 396; for (int i = 0; i < n; i ++) { int j = (i + 1) % 4; int x = min(a[i % 4], c[j] - a[j]); a[j] += x; a[i % 4] -= x; } for (int x : a) cout << x << ' '; cout << '\n'; return 0; }