結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
anta
|
| 提出日時 | 2016-06-18 00:21:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 1,000 ms |
| コード長 | 1,605 bytes |
| コンパイル時間 | 1,842 ms |
| コンパイル使用メモリ | 173,388 KB |
| 実行使用メモリ | 6,816 KB |
| 最終ジャッジ日時 | 2024-11-06 22:50:58 |
| 合計ジャッジ時間 | 2,339 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }
bool myissymbol(char c) {
return !isalnum(c);
}
int main() {
const vector<pair<string, string>> list = {
{ "digi", "nyo" },
{ "petit", "nyu" },
{ "rabi", "" },
{ "gema", "gema" },
{ "piyo", "pyo" }
};
char *buf = new char[100 * 1024 + 3];
while(fgets(buf, 100 * 1024 + 2, stdin) && !feof(stdin)) {
string s = buf;
if(s.back() == '\n') s.pop_back();
bool wrong = true;
for(const auto &p : list) {
if(s.size() < p.first.size() + 1 || s.substr(0, p.first.size() + 1) != p.first + ' ')
continue;
auto t = s.substr(p.first.size() + 1);
bool ok = false;
if(p.first == "rabi") {
for(char c : t)
ok |= !myissymbol(c);
} else {
rer(k, 0, 3) {
if(t.size() < p.second.size() + k) continue;
bool a = true;
rep(i, p.second.size())
a &= tolower(t[t.size() - k - p.second.size() + i]) == p.second[i];
rep(i, k) a &= myissymbol(t[t.size() - 1 - i]);
ok |= a;
}
}
wrong &= !ok;
}
puts(wrong ? "WRONG!" : "CORRECT (maybe)");
}
return 0;
}
anta