結果

問題 No.3526 Anti SKG
コンテスト
ユーザー umezo
提出日時 2026-05-05 01:00:20
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 739 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,953 ms
コンパイル使用メモリ 332,996 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-05 01:00:25
合計ジャッジ時間 4,225 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
using u128=__int128_t;
using ll=long long;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  string s;
  cin>>s;
  int n=s.size();
  for(int i=1;i<n-1;i++){
    if(s[i]!='.') continue;
    if(s[i-1]=='S' && s[i+1]=='G') s[i]='S';
  }
  rep(i,n) if(s[i]=='.') s[i]='K';
  bool b=true;
  rep(i,n-2){
    if(s.substr(i,3)=="SKG") b=false;
  }
  if(b){
    cout<<"Yes\n";
    cout<<s<<'\n';
  }
  else cout<<"No\n";
    
  return 0;
}
0