답안 #498427

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
498427 2021-12-25T07:54:11 Z Fake4Fun Vlak (COCI20_vlak) C++14
70 / 70
20 ms 9632 KB
#include<iostream>
using namespace std;
const int MAX=2e5+5;
int n,m;
int id,nex[26][MAX];
short val[MAX];
void add(string s,int x){
    int c=0;
    for(auto i:s){
        int z=i-'a';
        if(!nex[z][c]) nex[z][c]=++id;
        c=nex[z][c];
        val[c]|=x;
    }
}
#define BIT(x,i) (x>>i&1)
bool DFS(int node,bool x){
    bool Fin=0;
    for(int i=0;i<26;i++) if(nex[i][node]){
        int z=nex[i][node];
        if(!BIT(val[z],x)) continue;
        if(!BIT(val[z],!x)) return 1;
        else if(!DFS(z,!x)){Fin=1; break;}
    }
    return Fin;
}
int main(){
    string s;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>s, add(s,1);
    cin>>m;
    for(int i=1;i<=m;i++) cin>>s, add(s,2);
    cout<<(DFS(0,0)?"Nina":"Emilija");
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 560 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 556 KB Output is correct
4 Correct 1 ms 432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 540 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 9060 KB Output is correct
2 Correct 12 ms 8524 KB Output is correct
3 Correct 12 ms 8012 KB Output is correct
4 Correct 13 ms 8868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 9204 KB Output is correct
2 Correct 14 ms 9632 KB Output is correct
3 Correct 13 ms 8908 KB Output is correct
4 Correct 12 ms 9036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 8732 KB Output is correct
2 Correct 16 ms 8504 KB Output is correct
3 Correct 12 ms 8780 KB Output is correct
4 Correct 14 ms 9280 KB Output is correct