結果

問題 No.380 悪の台本
ユーザー vjudge1
提出日時 2025-04-18 16:53:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 4,147 bytes
コンパイル時間 2,012 ms
コンパイル使用メモリ 195,196 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-18 16:53:38
合計ジャッジ時間 2,877 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
??????
??????
??????
??????
D P ????
??????
??????
??????
??????
??? l l?
??????
??????
?? OI ??
??????
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define eps 1e-9
//#define ENF 1e13
const int N=1e7;
const int mod=1e9+7;
inline int read() {
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0'||ch>'9') {
		if (ch=='-') f=-1;
		ch=getchar();
	}
	while (ch>='0'&&ch<='9') {
		x=(x<<3)+(x<<1)+ch-48;
		ch=getchar();
	}
	return x*f;
}
void write(int x) {
	if(x<0)putchar('-'),x=-x;
	if(x<10)putchar(x+'0');
	else write(x/10),putchar(x%10+'0');
}
char c;
char cc[N];
int top;
char ans1[5]= {' ','o','y','n','+'};
char ans2[5]= {' ','u','y','n','+'};
char ans4[6]= {' ','a','m','e','g','+'};
char ans5[5]= {' ','o','y','p','+'};
signed main() {
//	freopen("dialogue.in","r",stdin);
//	freopen("dialogue.out","w",stdout);
	while(cin>>c) {
		bool fl=0;
		if(c=='\n') {
			string s;
			if(top<=4){
				cout<<"WRONG!\n";
				top=0;
				continue;
			}
			for(int i=1; i<=top; i++) {
				if(cc[i]==' ')break;
				s+=cc[i];
			}
			for(int i=1;i<=top;i++){
				if(cc[i]>='A'&&cc[i]<='Z')cc[i]+='a'-'A'; 
			}
			if(s=="digi") {
				int ttop=1;
				int sum=0;
				bool fg=0;
				for(int j=top; j>=5; j--) {
					if(!((cc[j]>='a'&&cc[j]<='z')||(cc[j]>='A'&&cc[j]<='Z')||(cc[j]>='0'&&cc[j]<='9'))) {
					if(fg) {
							cout<<"WRONG!\n";
							break;
						} 
						else sum++;
					} else {
						if(cc[j]<='Z'&&cc[j]>='A')cc[j]+='a'-'A';
						fg=1;
						if(cc[j]!=ans1[ttop]) {
							cout<<"WRONG!\n";
							break;
						}
						ttop++;
						if(ttop==4){
							cout<<"CORRECT (maybe)\n";
							break;
						}
					}
					if(sum>3) {
						cout<<"WRONG!\n";
						break;
					}
				}
			} else if(s=="petit") {
				int ttop=1;
				int sum=0;
				bool fg=0;
				for(int j=top; j>=6; j--) {
					if(!((cc[j]>='a'&&cc[j]<='z')||(cc[j]>='A'&&cc[j]<='Z')||(cc[j]>='0'&&cc[j]<='9'))) {
						if(fg) {
							cout<<"WRONG!\n";
							break;
						} else sum++;
					} else {
						if(cc[j]<='Z'&&cc[j]>='A')cc[j]+='a'-'A';
						fg=1;
						if(cc[j]!=ans2[ttop]) {
							cout<<"WRONG!\n";
							break;
						}
						ttop++;
						if(ttop==4){
							cout<<"CORRECT (maybe)\n";
							break;
						}
					}
					if(sum>3) {
						cout<<"WRONG!\n";
						break;
					}
				}
			} else if(s=="rabi") {
				bool fg=0;
				for(int j=5; j<=top; j++)
				if((cc[j]>='a'&&cc[j]<='z')||(cc[j]>='A'&&cc[j]<='Z')||(cc[j]>='0'&&cc[j]<='9')) {
						fg=1;
						cout<<"CORRECT (maybe)\n";
						break;
					}
				if(!fg)cout<<"WRONG!\n";
			} else if(s=="gema") {
				int ttop=1;
				int sum=0;
				bool fg=0;
				for(int j=top; j>=5; j--) {
					if(!((cc[j]>='a'&&cc[j]<='z')||(cc[j]>='A'&&cc[j]<='Z')||(cc[j]>='0'&&cc[j]<='9'))) {
						if(fg) {
							cout<<"WRONG!\n";
							break;
						} else sum++;
					} else {
						if(cc[j]<='Z'&&cc[j]>='A')cc[j]+='a'-'A';
						fg=1;
						if(cc[j]!=ans4[ttop]) {
							cout<<"WRONG!\n";
							break;
						}
						ttop++;
						if(ttop==5){
							cout<<"CORRECT (maybe)\n";
							break;
						}
					}
					if(sum>3) {
						cout<<"WRONG!\n";
						break;
					}
				}
			} else if(s=="piyo") {
				int ttop=1;
				int sum=0;
				bool fg=0;
				for(int j=top; j>=5; j--) {
					if(!((cc[j]>='a'&&cc[j]<='z')||(cc[j]>='A'&&cc[j]<='Z')||(cc[j]>='0'&&cc[j]<='9'))) {
						if(fg) {
							cout<<"WRONG!\n";
							break;
						}
						else sum++;
					} else {
						if(cc[j]<='Z'&&cc[j]>='A')cc[j]+='a'-'A';
						fg=1;
						if(cc[j]!=ans5[ttop]) {
							cout<<"WRONG!\n";
							break;
						}
						ttop++;
							if(ttop==4){
							cout<<"CORRECT (maybe)\n";
							break;
						}
					}
					if(sum>3) {
						cout<<"WRONG!\n";
						break;
					}
				}
			} 
			else cout<<"WRONG!\n";
			top=0;
			continue;
		}
		cc[++top]=c;
	}
	return 0;

}
// ?????????????AC????
// ?????????????????????????
// ??????????????????
// ????????????????????????????????????
// ???????????????????????????????
// ????????????
// ????????????
// ????????????
// ????????????????????
// ????????????????????
// ????????????????????????????????
// ???????????????????????
// ???????????
// ?????????????
0