結果

問題 No.1935 Water Simulation
ユーザー noya2
提出日時 2022-04-06 10:08:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 660 bytes
コンパイル時間 1,845 ms
コンパイル使用メモリ 197,440 KB
最終ジャッジ日時 2025-01-28 15:27:40
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 28
権限があれば一括ダウンロードができます

ソースコード

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