| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1011699 | vjudge1 | Vlak (COCI20_vlak) | C++98 | 17 ms | 11608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <map>
using namespace std;
struct node
{
map<char, node*> ch;
bool is_prefix[3];
bool win[3];
void add(string &x, int player, int i=0)
{
is_prefix[player]=true;
if(i>=x.size())
return;
char c = x[i];
if(ch.find(c)==ch.end())
ch[c]=new node();
ch[c]->add(x, player, i+1);
}
void run_dp()
{
//run dp on the children
bool lose[3]={};
for(auto X:ch)
{
X.second->run_dp();
if(!X.second->win[1])
lose[1]=true;
if(!X.second->win[2])
lose[2]=true;
}
win[1]=is_prefix[1] and lose[2];
win[2]=is_prefix[2] and lose[1];
}
};
node *root;
int main()
{
root = new node();
int n;
cin>>n;
while(n--)
{
string x;
cin>>x;
root->add(x, 1);
}
cin>>n;
while(n--)
{
string x;
cin>>x;
root->add(x, 2);
}
root->run_dp();
if(root->win[1])
cout<<"Nina"<<endl;
else
cout<<"Emilija"<<endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
