이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 100000000007
#define maxn 200005
#define maxm 28
ll T1[maxn][maxm];
ll T2[maxn][maxm];
bool solve(int node, bool turn){
if (!turn){
for (char i='a';i<='z';i++){
if (T1[node][i-'a']!=-1){
return !solve(T2[node][i-'a'],1);
}
}
return 0;
}
else{
for (char i='a';i<='z';i++){
if (T2[node][i-'a']!=-1){
return !solve(T1[node][i-'a'],1);
}
}
return 0;
}
}
int main()
{
memset(T1,-1,sizeof(T1));
memset(T2,-1,sizeof(T2));
int n; cin>>n;
ll next=1;
while(n--){
string s; cin>>s;
int i=0,v=0;
while(i<s.size()){
if (T1[v][s[i]-'a']==-1){
T1[v][s[i]-'a']=next;
v=next;
next++;
}
else
{
v=T1[v][s[i]-'a'];
}
++i;
}
}
next=1; cin>>n;
while(n--){
string s; cin>>s;
int i=0,v=0;
while(i<s.size()){
if (T2[v][s[i]-'a']==-1){
T2[v][s[i]-'a']=next;
v=next;
next++;
}
else
{
v=T2[v][s[i]-'a'];
}
++i;
}
}
bool ans=solve(0,0);
if (ans)
cout<<"Nina"<<endl;
else
cout<<"Emilija"<<endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int main()':
Main.cpp:36:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
36 | while(i<s.size()){
| ~^~~~~~~~~
Main.cpp:53:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | while(i<s.size()){
| ~^~~~~~~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |