結果

問題 No.1362 [Zelkova 8th Tune] Black Sheep
ユーザー hatsuka_iwa
提出日時 2021-01-24 22:16:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 1,000 ms
コード長 646 bytes
コンパイル時間 1,534 ms
コンパイル使用メモリ 169,320 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 16:08:03
合計ジャッジ時間 2,611 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  string S;
  cin >> S;
  tuple<char, int, int, bool> A, B;
  get<0>(A) = S.at(0);
  get<1>(A) = 1;
  get<2>(A) = 1;
  get<3>(A) = true;

  for (int i = 1; i < (int)S.size(); i++) {
    if (S.at(i) != get<0>(A) && get<3>(B) == false) {
      get<0>(B) = S.at(i);
      get<1>(B) = i + 1;
      get<2>(B) = 1;
      get<3>(B) = true;
    }
    else if (S.at(i) != get<0>(A) && get<3>(B) == true)
      get<2>(B)++;
    else
      get<2>(A)++;
  }

  if (get<2>(A) > get<2>(B))
    cout << get<1>(B) << ' ' << get<0>(B) << endl;
  else
    cout << get<1>(A) << ' ' << get<0>(A) << endl;
}
0