Submission #242361

# Submission time Handle Problem Language Result Execution time Memory
242361 2020-06-27T09:54:29 Z Vimmer Planinarenje (COCI18_planinarenje) C++14
0 / 160
47 ms 5504 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")

#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 200101
#define M ll(1e9 + 7)
#define inf 1e9 + 1e9

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef short int si;
typedef array <int, 2> a2;

//typedef tree <int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int mt[N];

bool mrk[N];

vector <int> g[N];

bool kuna(int v)
{
    if (mrk[v]) return 0;

    mrk[v] = 1;

    for (auto it : g[v])
      if (mt[it] == -1 || kuna(mt[it])) {mt[it] = v; return 1;}

    return 0;
}

bool gdr(int v)
{
    if (mrk[v]) return 0;

    mrk[v] = 1;

    for (auto it : g[v])
      if (mt[it] == -1 || gdr(mt[it])) return 1;

    return 0;
}
int main()
{
    //freopen("input.txt", "r", stdin); //freopen("output4.txt", "w", stdout);

    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n, m;

    cin >> n >> m;

    for (int i = 0; i < m; i++)
    {
        int x, y;

        cin >> x >> y;

        y += n;

        g[x].pb(y);

        g[y].pb(x);
    }

    for (int i = 1; i <= n + n; i++) mt[i] = -1;

    for (int i = 1; i <= n; i++)
    {
        memset(mrk, 0, sizeof(mrk));

        kuna(i);
    }

    for (int i = 1; i <= n; i++)
        if (mt[i] == -1) cout << "Mirko" << endl;
          else
          {
                for (int j = 1; j <= n + n; j++) mrk[j] = 0;

                bool gd = gdr(mt[i]);

                if (gd) cout << "Mirko" << endl;
                  else cout << "Slavko" << endl;
          }


}
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 5248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 5376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 5248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 5248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 5504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 5248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 5376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 5376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 5376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 5376 KB Output isn't correct
2 Halted 0 ms 0 KB -