# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
106644 | ArshiaDadras | Planinarenje (COCI18_planinarenje) | C++14 | 8 ms | 1024 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* In the name of Allah */
#include<bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
int n, m, match[N];
vector<int> adj[N];
bitset<N> mark;
bool dfs1(int u) {
mark[u] = true;
for (auto v: adj[u])
if (!~match[v] || (!mark[match[v]] && dfs1(match[v]))) {
match[match[v] = u] = v;
return true;
}
return false;
}
void dfs2(int u) {
mark[u] = true;
for (auto v: adj[u])
if (~match[v] && !mark[match[v]])
dfs2(match[v]);
}
int main() {
scanf("%d%d", &n, &m);
for (int i = 0; i < m; i++) {
int u, v;
scanf("%d%d", &u, &v);
adj[--u].push_back(v += n - 1), adj[v].push_back(u);
}
memset(match, -1, sizeof match);
for (int ok = 1; ok; mark.reset())
for (int u = ok = 0; u < n; u++)
if (!~match[u] && !mark[u])
ok |= dfs1(u);
for (int u = 0; u < n; u++)
if (!~match[u] && !mark[u])
dfs2(u);
for (int u = 0; u < n; u++)
printf(mark[u]? "Mirko\n": "Slavko\n");
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |