Submission #299082

# Submission time Handle Problem Language Result Execution time Memory
299082 2020-09-14T13:07:35 Z jovan_b Planinarenje (COCI18_planinarenje) C++17
96 / 160
1000 ms 768 KB
#include <bits/stdc++.h>
using namespace std;

vector <int> graf[10005];
int mt[10005];
bool used[10005];

bool bp(int v) {
	if (used[v])  return false;
	used[v] = true;
	for (auto c : graf[v]) {
		if(!mt[c] || bp(mt[c])) {
			mt[c] = v;
			return true;
		}
	}
	return false;
}

int main()
{
    int n, m;
    cin >> n >> m;
    for(int i=1; i<=m; i++){
        int a, b;
        cin >> a >> b;
        graf[a].push_back(b);
    }
    int mxm = 0;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++) used[j] = 0;
        mxm += bp(i);
    }
    for(int i=1; i<=n; i++){
        int tren = 0;
        for(int j=1; j<=n; j++) mt[j] = 0;
        for(int j=1; j<=n; j++){
            if(j == i) continue;
            for(int k=1; k<=n; k++) used[k] = 0;
            tren += bp(j);
        }
        if(tren-mxm) cout << "Slavko\n";
        else cout << "Mirko\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 640 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 632 KB Output is correct
2 Correct 67 ms 512 KB Output is correct
3 Correct 76 ms 612 KB Output is correct
4 Correct 75 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 768 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 526 ms 760 KB Output is correct
2 Correct 253 ms 640 KB Output is correct
3 Correct 316 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 270 ms 628 KB Output is correct
2 Correct 955 ms 632 KB Output is correct
3 Correct 378 ms 632 KB Output is correct
4 Correct 149 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 640 KB Time limit exceeded
2 Halted 0 ms 0 KB -