結果

問題 No.1935 Water Simulation
ユーザー cho435cho435
提出日時 2022-05-13 22:41:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 728 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 177,876 KB
実行使用メモリ 7,636 KB
最終ジャッジ日時 2023-09-29 08:14:12
合計ジャッジ時間 5,420 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 TLE -
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>
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);
  vector<map<vector<int>,int>> st(4);
  st.at(3)[dd]=-1;
  rep(i,n){
//    for(auto k:dd)cout<<k<<" ";
//    cout<<endl;
    mv(i%4);
    if(st.at(i%4).count(dd)) i+=(i-st.at(i%4).at(dd))*((n-i-1)/(i-st.at(i%4).at(dd)));
    else st.at(i%4)[dd]=i;
  }
  for(auto k:dd)cout<<k<<" ";
  cout<<endl;
}
0