結果

問題 No.1935 Water Simulation
ユーザー noya2noya2
提出日時 2022-04-06 10:08:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 660 bytes
コンパイル時間 2,023 ms
コンパイル使用メモリ 200,588 KB
実行使用メモリ 8,772 KB
最終ジャッジ日時 2023-08-25 02:26:36
合計ジャッジ時間 5,499 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,772 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
using namespace std;
template<class T>istream &operator>>(istream &is,vector<T> &v){for(auto &e:v)is>>e;return is;}
template<class T>ostream &operator<<(ostream &os,const vector<T> &v){if(v.size()!=0){rep(i,v.size())os<<v[i]<<(i+1==v.size()?"":" ");}return os;}
template<typename T>void o(T a){cout<<a<<endl;}

int main(){
    vector<int> v(4); cin >> v;
    vector<int> a(4,0);
    a[0] = v[0];
    int n; cin >> n;
    auto f = [&](int x){
        int y = (x + 1) % 4;
        int w = min(a[x],v[y]-a[y]);
        a[x] -= w;
        a[y] += w;
    };
    rep(i,n) f(i%4);
    o(a);
}
0