結果

問題 No.2535 多重同値
ユーザー kumakumakumakuma
提出日時 2023-04-26 21:43:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 1,162 bytes
コンパイル時間 1,873 ms
コンパイル使用メモリ 203,128 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 22:34:00
合計ジャッジ時間 2,539 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
// #include <atcoder/modint>
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define INF 2000000000000000000
#define ll long long
#define ull unsigned long long
#define ld long double
#define pll pair<ll, ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const double PI = 3.141592653589793238462643383279;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  assert(1 <= N && N <= 100000);
  vector<bool> P(N, false);
  for (ll i = 0; i < N; ++i) {
    string p;
    cin >> p;
    assert(p == "Yes" || p == "No");
    if (p == "Yes") {
      P.at(i) = true;
    }
  }
  bool ans = P.at(0);
  for (ll i = 0; i < N; ++i) {
    if (i != 0) {
      if (P.at(i - 1) != P.at(i)) {
        if (P.at(i - 1)) {
          ans = !ans;
        }
      }
      else {
        if (!P.at(i - 1)) {
          ans = !ans;
        }
      }
    }
    if (ans) {
      cout << "Yes" << "\n";
    }
    else {
      cout << "No" << "\n";
    }
  }
}
0