Submission #377394

# Submission time Handle Problem Language Result Execution time Memory
377394 2021-03-14T06:51:30 Z Araragi Vlak (COCI20_vlak) C++17
0 / 70
10 ms 1004 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)
            who[1]++;
        else
            who[0]++;
    }

    if (who[0] > who[1])
        cout << "Nina";
    else if (who[0] < who[1])
        cout << "Emilija";
    else
        cout << "Nina";
}

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;
      |                  ^~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1004 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 748 KB Output is correct
2 Correct 2 ms 748 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
4 Incorrect 3 ms 620 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 876 KB Output is correct
2 Correct 5 ms 876 KB Output is correct
3 Incorrect 3 ms 1004 KB Output isn't correct
4 Halted 0 ms 0 KB -