結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-04-26 17:46:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,215 bytes |
| コンパイル時間 | 2,222 ms |
| コンパイル使用メモリ | 200,320 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-26 17:46:33 |
| 合計ジャッジ時間 | 3,253 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:96:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
96 | freopen("dialogue.in", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:97:12: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
97 | freopen("dialogue.out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#include <cctype>
#define int long long
const int N = 1e5 + 5;
const int Mod = 1e9 + 7;
using namespace std;
string S;
void solve()
{
string name = "";
int i = 0;
while (i < S.size() && S[i] != ' ')
{
name += S[i];
i++;
}
i++;
if (i < S.size())
{
S = S.substr(i, S.size());
}
if (name == "rabi")
{
for (char i : S)
{
if (!isalnum(i))
{
cout << "WRONG!" << endl;
return;
}
}
cout << "CORRECT (maybe)" << endl;
return;
}
i = S.size() - 1;
while (i >= 0 && !isalnum(S[i]))
{
if (S.size() - i > 3)
{
cout << "WRONG!" << endl;
return;
}
i--;
}
S = S.substr(0, i + 1);
if (name == "digi" || name == "petit" || name == "piyo")
{
if (S.size() < 3)
{
cout << "WRONG!" << endl;
return;
}
string tmp;
for (int i = S.size() - 3; i <= S.size() - 1; i++)
{
tmp += tolower(S[i]);
}
if (name == "digi" && tmp == "nyo")
{
cout << "CORRECT (maybe)" << endl;
return;
}
if (name == "petit" && tmp == "nyu")
{
cout << "CORRECT (maybe)" << endl;
return;
}
if (name == "piyo" && tmp == "pyo")
{
cout << "CORRECT (maybe)" << endl;
return;
}
}
if (name == "gema")
{
if (S.size() < 4)
{
cout << "WRONG!" << endl;
return;
}
string tmp;
for (int i = S.size() - 4; i <= S.size() - 1; i++)
{
tmp += tolower(S[i]);
}
if (tmp == "gema")
{
cout << "CORRECT (maybe)" << endl;
return;
}
}
cout << "WRONG!" << endl;
}
signed main()
{
freopen("dialogue.in", "r", stdin);
freopen("dialogue.out", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
while (getline(cin, S))
{
solve();
}
return 0;
}
vjudge1