結果

問題 No.149 碁石の移動
ユーザー parsee1053parsee1053
提出日時 2020-08-22 18:13:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 954 bytes
コンパイル時間 1,039 ms
コンパイル使用メモリ 80,388 KB
実行使用メモリ 7,012 KB
最終ジャッジ日時 2024-04-23 12:02:34
合計ジャッジ時間 1,959 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,248 KB
testcase_01 AC 4 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 7 ms
5,376 KB
testcase_06 AC 7 ms
5,452 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 5 ms
5,376 KB
testcase_11 AC 8 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 11 ms
6,240 KB
testcase_16 AC 15 ms
7,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  vector<int> v, u;
  int aw, ab;
  cin >> aw >> ab;
  for (int i = 0; i < aw; ++i) {
    v.push_back(0);
  }
  for (int i = 0; i < ab; ++i) {
    v.push_back(1);
  }
  int bw, bb;
  cin >> bw >> bb;
  for (int i = 0; i < bw; ++i) {
    u.push_back(0);
  }
  for (int i = 0; i < bb; ++i) {
    u.push_back(1);
  }
  int c, d;
  cin >> c >> d;
  while (c--) {
    int val = v.back();
    v.pop_back();
    u.push_back(val);
  }
  sort(u.rbegin(), u.rend());
  while (d--) {
    int val = u.back();
    u.pop_back();
    v.push_back(val);
  }
  int ans = 0;
  for (int i = 0; i < v.size(); ++i) {
    ans += (v[i] == 0);
  }
  cout << ans << endl;
  return 0;
}
0