답안 #1011701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011701 2024-07-01T06:55:24 Z vjudge1 Vlak (COCI20_vlak) C++17
70 / 70
14 ms 9820 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
int const N=2e5+5;
int const mod=1e9+7;

int nxt[N][26];
bool st1[N],st2[N];
bool is_pre[N][2],win[N][2];
int cnt=1;
void dfs(int node){
	for (int i = 0; i < 26; ++i)
	{
		if(nxt[node][i]==0)
			continue;
		int nt=nxt[node][i];
		dfs(nt);
		win[node][0] |= is_pre[nt][0] &&  (!win[nt][1]);
		win[node][1] |= is_pre[nt][1] &&  (!win[nt][0]);
	}
}
int main(){
	for (int p = 0; p < 2; ++p)
	{
		int n;
		cin>>n;
		for (int i = 0; i < n; ++i)
		{
			string a;
			cin>>a;
			int cur=0;
			for(char c:a){
				if(nxt[cur][c-'a']==0)
					nxt[cur][c-'a']=cnt++;
				is_pre[cur][p]=1;
				cur=nxt[cur][c-'a'];
			}
			is_pre[cur][p]=1;
		}
	}
	dfs(0);
	if(win[0][0])
		cout<<"Nina"<<endl;
	else
		cout<<"Emilija"<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 9304 KB Output is correct
2 Correct 13 ms 8828 KB Output is correct
3 Correct 11 ms 8280 KB Output is correct
4 Correct 11 ms 9052 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9560 KB Output is correct
2 Correct 10 ms 9820 KB Output is correct
3 Correct 11 ms 9284 KB Output is correct
4 Correct 11 ms 9280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 9048 KB Output is correct
2 Correct 11 ms 8792 KB Output is correct
3 Correct 11 ms 9136 KB Output is correct
4 Correct 12 ms 9580 KB Output is correct