30分求助,只subtask2
查看原帖
30分求助,只subtask2
669924
guozhetao楼主2023/1/24 21:51

链接

#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>

using namespace std;

// 快读
inline int read() {
	int x = 0,f = 1;char ch = getchar();
	while (ch < '0' or ch > '9'){if (ch == '-') f = -1;ch = getchar();}
	while (ch >= '0' and ch <='9'){x = x * 10 + ch - 48;ch = getchar();}
	return x * f;
}
int t,n,m;
string a[1005],b[10];
void check() {
	string a[20];
	bool v = 1;
	for(int i = 1;i <= 2 * m;i++) {
		cin>>a[i];
		int kk = a[i].size();
		string s1 = "freopen(\"" + b[(i + 1) / 2] + ".in\",\"r\",stdin);",s2 = "freopen(\"" + b[(i + 1) / 2] + ".out\",\"w\",stdout);";
		if(a[i].substr(0,10) == "//freopen(" and a[i].substr(kk - 2,2) == ");") {
			printf("Wrong file operation takes you to your ancestors along with your 3 years' efforts on OI.\n");
			return;
		}
		if(v == 0) continue;
		if(i & 1) {
			if(a[i] != s1){
                v = 0;
                //cout<<a[i]<<" "<<s1<<endl;
            }
		}
		else {
			if(a[i] != s2) {
                v = 0;
                //cout<<a[i]<<" "<<s2<<endl;
    		}
        }
	}
	if(v) printf("PION2202 RP++.\n");
	else printf("Good luck and have fun.\n");
	return;
	
}
int main() {
	t = read(),n = read(),m = read();
	for(int i = 1;i <= m;i++) {
		cin>>b[i];
	}
	while(n--) {
		check();
	}
    return 0;
}
2023/1/24 21:51
加载中...