結果

問題 No.3655 Adjacent Pairs in Triplets
コンテスト
ユーザー rinrion
提出日時 2026-08-30 13:43:57
言語 C++14
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,044 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,702 ms
コンパイル使用メモリ 252,380 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-30 13:44:22
合計ジャッジ時間 4,122 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
#define rep(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define repr(i, s, n) for (int i = (s); i >= (int)(n); --i)
#define sz(x) ((int)(x).size())
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
auto _ = []{ios::sync_with_stdio(false); cin.tie(nullptr); return 0;}();
const int INFI = 1 << 30;
const ll INFL = 1LL << 62;

int main() {
	string s;
	cin >> s;
	int n=sz(s);
	ll sm=0;

	rep (i, 0, n-2){
		map<char,int>mp;
		rep (j, 0, 3){
			mp[s[i+j]]++;
		}
		if(sz(mp)!=2)continue;
		if(mp[s[i]]==1&&mp[s[i+1]==1])continue;
		sm++;
	}
	cout << sm << '\n';
	
	return 0;
}
0