Submission #838157

# Submission time Handle Problem Language Result Execution time Memory
838157 2023-08-26T09:46:00 Z jamielim Planinarenje (COCI18_planinarenje) C++14
0 / 160
2 ms 852 KB
#include <bits/stdc++.h>
using namespace std;
 
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ii,ii> i4;
typedef vector<int> vi;
const int MOD=1000000007;
const int INF=1012345678;
const ll LLINF=1012345678012345678LL;
const double PI=3.1415926536;
const double EPS=1e-14;

int n,m;
int match[10005];
int vis[10005];
bool poss[5005];
vector<int> adj[10005];

bool dfs(int x){
	if(vis[x])return 0;
	vis[x]=1;
	for(int i:adj[x]){
		if(!match[i]||dfs(match[i])){
			match[i]=x;
			match[x]=i;
			return 1;
		}
	}
	return 0;
}

int main(){
	scanf("%d%d",&n,&m);
	int a,b;
	for(int i=0;i<m;i++){
		scanf("%d%d",&a,&b);
		b+=n;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	for(int i=1;i<=n;i++){
		if(!vis[i])dfs(i);
	}
	for(int i=1;i<=n;i++)if(match[i])poss[i]=1;
	for(int i=1;i<=n;i++){
		if(!poss[i]&&!dfs(i))printf("Mirko\n");
		else printf("Slavko\n");
	}
}

Compilation message

planinarenje.cpp: In function 'int main()':
planinarenje.cpp:40:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |  scanf("%d%d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~
planinarenje.cpp:43:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |   scanf("%d%d",&a,&b);
      |   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 544 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 724 KB Output isn't correct
2 Halted 0 ms 0 KB -