結果
| 問題 |
No.342 一番ワロタww
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-07-19 02:10:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,412 bytes |
| コンパイル時間 | 1,758 ms |
| コンパイル使用メモリ | 176,108 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 13:38:15 |
| 合計ジャッジ時間 | 2,494 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 1 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
cin.tie(0);\
ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define print(x) cout << x << "\n"
typedef vector<int> vi;
bool check(char c0, char c1, char c2) {
string cs = "w";
return c0==cs[0] && c1==cs[1] && c2==cs[2];
}
int main() {
fastcin;
string s;
cin >> s;
int con = 0, ano = 0;
vi si, tmp;
for(int i=0; i<s.size(); i+=3) {
if(check(s[i], s[i+1], s[i+2])) {
if(ano>0) {
si.push_back(-ano);
ano = 0;
}
con++;
} else {
if(con>0) {
si.push_back(con);
con = 0;
}
ano++;
}
}
if(con>0) si.push_back(con);
if(ano>0) si.push_back(-ano);
tmp = si;
if(tmp[0]>0) tmp[0] = -tmp[0];
sort(tmp.rbegin(), tmp.rend());
int m = tmp[0], cnt = 1;
if(m>0) {
rep(i, 1, tmp.size()) {
if(m!=tmp[i]) break;
else cnt++;
}
int sidx = 0, siidx = 0;
while(cnt>0) {
if(siidx!=0 && si[siidx]==m) {
string p = s.substr(sidx-abs(si[siidx-1])*3, abs(si[siidx-1])*3);
print(p);
cnt--;
}
sidx += 3*abs(si[siidx]);
siidx++;
}
}
return 0;
}