結果

問題 No.632 穴埋め門松列
ユーザー traindoggotraindoggo
提出日時 2024-02-06 06:32:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,486 bytes
コンパイル時間 6,497 ms
コンパイル使用メモリ 203,320 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-06 06:32:44
合計ジャッジ時間 3,146 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG_
#include <compe/debug.hpp>
#else
#define dump(...)
#endif

#define FastIO cin.tie(nullptr), ios_base::sync_with_stdio(false);
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define output(msg) cout << (msg) << '\n'
#define die(msg)         \
  do {                   \
    cout << msg << endl; \
    exit(0);             \
  } while (0)
#define all(k) k.begin(), k.end()
#define INFi 1 << 30
#define INFll 1LL << 60

template <typename T> bool chmax(T& a, const T& b) {
  return ((a < b) ? (a = b, true) : (false));
}
template <typename T> bool chmin(T& a, const T& b) {
  return ((a > b) ? (a = b, true) : false);
}

using llint = long long int;

bool is_ok(vector<int> vi) {
  bool ok{false};
  int a1 = vi[0], a2 = vi[1], a3 = vi[2];

  if (a2 > a1 && a1 > a3) ok = true;
  if (a2 > a3 && a3 > a1) ok = true;

  if (a2 < a1 && a1 < a3) ok = true;
  if (a2 < a3 && a3 < a1) ok = true;

  return ok;
}

int main() {
  FastIO;
  vector<int> vi(3);
  rep(i, 3) {
    char c;
    cin >> c;
    if (c == '?')
      vi[i] = 0;
    else
      vi[i] = c - '0';
  }
  dump(vi);

  vector<int> t1 = vi, t2 = vi;
  rep(i, 3) {
    if (t1[i] == 0) {
      t1[i] = 1;
    }
  }

  rep(i, 3) {
    if (t2[i] == 0) {
      t2[i] = 4;
    }
  }

  int cnt{};
  if (is_ok(t1)) cnt += 1;
  if (is_ok(t2)) cnt += 2;
  dump(cnt);

  if (cnt == 1)
    output(1);
  else if (cnt == 2)
    output(4);
  else if (cnt == 3)
    output(14);
}
0