結果
問題 | No.342 一番ワロタww |
ユーザー |
|
提出日時 | 2018-07-19 02:08:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,336 bytes |
コンパイル時間 | 2,043 ms |
コンパイル使用メモリ | 177,236 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-17 19:50:35 |
合計ジャッジ時間 | 3,261 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 1 RE * 3 |
ソースコード
#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; 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; }