이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const N=10005;
int const mod=1e9+7;
int n,m;
vector<int> adj[N];
bool state[N];
bool vis[N];
void dfs(int node,int par){
if(node<=n)
state[node]=1;
vis[node]=1;
for(int i:adj[node]){
if(i!=par && vis[i]==0)
dfs(i,node);
}
vis[node]=0;
if(node<=n){
for(int i:adj[node])
if(vis[i]==0 && i!=par && state[i]==0){
state[node]=0;
return;
}
}
else{
for(int i:adj[node])
if(vis[i]==0 && i!=par && state[i]==1){
state[node]=1;
return;
}
}
}
int main(){
cin>>n>>m;
for(int i=0;i<m;i++){
int a,b;
cin>>a>>b;
b+=n;
adj[a].push_back(b);
adj[b].push_back(a);
}
for(int i=1;i<=n;i++){
for(int j=0;j<=2*n;j++){
state[j]=0;
vis[j]=0;
}
dfs(i,0);
if(state[i])
cout<<"Mirko"<<endl;
else
cout<<"Slavko"<<endl;
}
return 0;
}
# | 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... |