結果

問題 No.1935 Water Simulation
ユーザー cho435cho435
提出日時 2022-05-13 21:55:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 1,638 ms
コンパイル使用メモリ 172,688 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-29 07:06:31
合計ジャッジ時間 2,961 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for (int i=0;i<(int)(n);i++)

vector<int> v(4);
vector<int> dd(4,0);

void mv(int x){
  int cmv=v.at((x+1)%4)-dd.at((x+1)%4);
  if(dd.at(x)>cmv){
    dd.at((x+1)%4)=v.at((x+1)%4);
    dd.at(x)-=cmv;
  }else{
    dd.at((x+1)%4)+=dd.at(x);
    dd.at(x)=0;
  }
}

int main(){
  rep(i,4) cin>>v.at(i);
  ll n;
  cin>>n;
  ll cn=0;
  dd.at(0)=v.at(0);
  set<vector<int>> st;
  st.insert(dd);
  rep(i,n){
//    for(auto k:dd)cout<<k<<" ";
//    cout<<endl;
    mv(i%4);
    if(st.count(dd)) i+=4*((n-i)/4);
    else st.insert(dd);
  }
  for(auto k:dd)cout<<k<<" ";
  cout<<endl;
}
0