結果

問題 No.341 沈黙の期間
ユーザー motimoti
提出日時 2018-02-24 12:45:17
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,267 bytes
コンパイル時間 2,241 ms
コンパイル使用メモリ 193,156 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 08:06:21
合計ジャッジ時間 2,854 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
/*
  std::string hoge = "…";
  for (size_t i = 0; i < hoge.size(); ++i) {
    std::cout << "idx: " << i << ", " << std::to_string(hoge[i]) << "\n";
  }
  idx: 0, -30
  idx: 1, -128
  idx: 2, -90
*/
  std::string s; std::cin >> s;
//  std::cout << s << "\n";
  int ans = 0, cand = 0;
  int hoge = 3;
  for (size_t i = 0; i < s.size(); ++i) {
    if (i + 2 < s.size() && s[i] == -30 && s[i+1] == -128 && s[i+2] == -90) {
      cand++;
      hoge = 1;
    } else if (hoge < 3) {
      hoge++;
    } else {
      ans = max(ans, cand);
      cand = 0;
    }
  }

  ans = max(ans, cand);
  std::cout << ans << "\n";
  
  return 0;
}
0