답안 #377399

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
377399 2021-03-14T07:00:23 Z Araragi Vlak (COCI20_vlak) C++17
30 / 70
13 ms 1036 KB
    #pragma GCC optimize("-O3")
#include <bits/stdc++.h>
#define pb push_back
using namespace std;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n;
    cin >> n;

    vector<string> nin(n);
    for (auto& it : nin)
        cin >> it;

    int m;
    cin >> m;

    vector<string> em(m);
    for (auto& it : em)
        cin >> it;

    map<int, int> who;

    for (auto ni : nin)
    {
        bool emi = false;

        for (auto e : em)
        {
            //cerr << "[compare]: " << ni << " " << e << '\n';

            bool nin_win = false, emi_win = false;
            int pref = 0;

            for (int i = 0; i < min((int)ni.size(), (int)e.size()); i++)
                if (ni[i] == e[i])
                    pref++;
                else break;

            //cerr << "[debug]: pref is " << pref << '\n';

            if (pref == 0)
            {
                nin_win = true;
            }
            else if (pref == min((int)ni.size(), (int)e.size()))
            {
                if (min((int)ni.size(), (int)e.size()) % 2)
                    nin_win = true;
                else
                    emi_win = true;
            }
            else
            {
                if (pref % 2)
                    emi_win = true;
                else nin_win = true;
            }

            if (emi_win)
            {
                emi = true;
                break;
            }
        }

        if (!emi)
        {
            cout << "Nina";
            exit(0);
        }
    }

    cout << "Emilija";
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:34:18: warning: variable 'nin_win' set but not used [-Wunused-but-set-variable]
   34 |             bool nin_win = false, emi_win = false;
      |                  ^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1036 KB Output is correct
2 Correct 5 ms 1004 KB Output is correct
3 Incorrect 13 ms 1024 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 768 KB Output is correct
2 Correct 2 ms 748 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
4 Correct 2 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 876 KB Output is correct
2 Correct 5 ms 876 KB Output is correct
3 Incorrect 3 ms 876 KB Output isn't correct
4 Halted 0 ms 0 KB -