結果

問題 No.2434 RAKUTAN de RAKUTAN
ユーザー Astral__Astral__
提出日時 2023-08-11 18:09:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,031 bytes
コンパイル時間 1,906 ms
コンパイル使用メモリ 205,060 KB
実行使用メモリ 7,160 KB
最終ジャッジ日時 2024-04-30 11:12:31
合計ジャッジ時間 3,968 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i, s, f) for(ll i = s; i <= f; i++)
using namespace std;
typedef long long ll;

void solve() {
   ll N, H, X;
  cin >> N >> H >> X;
  ll G, B;
  cin >> G;
  vector<ll> g(G+1);
  for(int i = 1; i <= G; i++) {
    cin >> g.at(i);
   
  }
  cin >> B;
  vector<ll> b(B+1);
  for(int i = 1; i <= B; i++) {
    cin >> b.at(i);
  }

  vector<ll> table(N+1, 0);
  rep(i, 1, G){
    table.at(g.at(i)) = 1;
  }
  rep(i, 1, B) {
    table.at(b.at(i)) = -1;
  }

  ll ans = 0;
  rep(i, 1, N) {
    if(table.at(i) == 1) {
        ans++;
    }
    else if(table.at(i) == -1) {
    if (H > 0 && i + X <= N) {
        i += X - 1;
        H--;
    }
    else {
      ans--;
    }
  }
  }

  cout << ans << endl;




}
//stringでの数字の下から1桁目は 正:S.at(N-1)  誤:S.at(0)
//if(S.at(i) == 1 ← charなのに1...?
// modは取りましたか...?(´・ω・`)



int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  cout << fixed << setprecision(15);
  solve();
  return 0;
}
0