結果
| 問題 | No.3526 Anti SKG |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-05-05 11:56:20 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 771 bytes |
| 記録 | |
| コンパイル時間 | 310 ms |
| コンパイル使用メモリ | 53,056 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-05-05 11:56:26 |
| 合計ジャッジ時間 | 2,242 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3526.cc: No.3526 Anti SKG - yukicoder
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 200000;
/* typedef */
/* global variables */
char t[MAX_N + 4];
/* subroutines */
/* main */
int main() {
scanf("%s", t);
int n = strlen(t);
for (int i = 0; i + 3 <= n; i++)
if (t[i] == 'S' && t[i + 1] == 'K' && t[i + 2] == 'G') {
puts("No");
return 0;
}
for (int i = 0; i < n; i++) {
if (t[i] == '.') {
if (i < 2 || t[i - 2] != 'S' || t[i - 1] != 'K')
t[i] = 'G';
else if (i < 1 || i + 1 >= n || t[i - 1] != 'S' || t[i + 1] != 'G')
t[i] = 'K';
else
t[i] = 'S';
}
}
puts("Yes");
puts(t);
return 0;
}
tnakao0123