# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
299011 | 2020-09-14T12:12:34 Z | TadijaSebez | Planinarenje (COCI18_planinarenje) | C++11 | 15 ms | 640 KB |
#include <bits/stdc++.h> using namespace std; #define pb push_back const int N=5050; vector<int> E[N]; int mch[N]; bool was[N]; void cl(){for(int i=0;i<N;i++)was[i]=0;} bool DFS(int u){ if(was[u])return 0; was[u]=1; for(int v:E[u]){ if(!mch[v]){ mch[v]=u; return 1; }else{ if(DFS(mch[v])){ mch[v]=u; return 1; } } } return 0; } bool ok[N]; void EXP(int u){ for(int v:E[u]){ assert(mch[v]); if(ok[mch[v]]){ ok[mch[v]]=0; EXP(mch[v]); } } } int main(){ int n,m; scanf("%i %i",&n,&m); for(int i=1;i<=m;i++){ int u,v; scanf("%i %i",&u,&v); E[u].pb(v); } for(int i=1;i<=n;i++)cl(),ok[i]=DFS(i); for(int i=1;i<=n;i++)if(!ok[i])EXP(i); for(int i=1;i<=n;i++){ if(ok[i])printf("Slavko\n"); else printf("Mirko\n"); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 2 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 640 KB | Output is correct |
2 | Correct | 15 ms | 640 KB | Output is correct |
3 | Correct | 15 ms | 640 KB | Output is correct |
4 | Correct | 15 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 512 KB | Output is correct |
2 | Correct | 4 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 6 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 3 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 512 KB | Output is correct |
2 | Correct | 15 ms | 640 KB | Output is correct |
3 | Correct | 9 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 512 KB | Output is correct |
2 | Correct | 12 ms | 640 KB | Output is correct |
3 | Correct | 7 ms | 640 KB | Output is correct |
4 | Correct | 5 ms | 640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 512 KB | Output is correct |
2 | Correct | 8 ms | 640 KB | Output is correct |
3 | Correct | 11 ms | 640 KB | Output is correct |
4 | Correct | 6 ms | 640 KB | Output is correct |