# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
23705 | 2017-05-21T22:38:37 Z | Hiasat | 친구 (IOI14_friend) | C++14 | 0 ms | 3360 KB |
#include "friend.h" #include <bits/stdc++.h> using namespace std; vector<int> adj[1002]; int c[1002], vis[1001], vsId, match[1001]; vector<int> fv[2]; void dfs(int u , int color) { if (c[u] != -1) { assert(c[u] == color); return; } c[u] = color; fv[color].push_back(u); for (int i = 0; i < adj[u].size(); ++i) { dfs(adj[u][i], !color); } } bool findMatch(int u) { vis[u] = vsId; for (int i = 0; i < adj[u].size(); ++i) { int v = adj[u][i]; if (match[v] == -1 || vis[match[v]] != vsId && findMatch(match[v])) { match[v] = u; return true; } } return false; } int findSample(int n, int confidence[], int host[], int protocol[]) { memset(c, -1, sizeof c); for (int i = 1 ; i <= n - 1; i++) { if (protocol[i] == 0) { adj[host[i]].push_back(i); adj[i].push_back(host[i]); } if (protocol[i] == 1) { for (int j = 0 ; j < adj[host[i]].size(); j++) { int v = adj[host[i]][j]; adj[v].push_back(i); adj[i].push_back(v); } } } memset(match, -1, sizeof match); int cur = 0; for (int i = 0; i < n; ++i) { if (c[i] != -1) continue; dfs(i, 0); } for (int j = 0 ; j < fv[0].size(); j++) { int v = fv[0][j]; vsId++; if (findMatch(v)) cur++; } return n - cur; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 3228 KB | Output is correct |
2 | Correct | 0 ms | 3228 KB | Output is correct |
3 | Correct | 0 ms | 3228 KB | Output is correct |
4 | Correct | 0 ms | 3228 KB | Output is correct |
5 | Correct | 0 ms | 3228 KB | Output is correct |
6 | Correct | 0 ms | 3228 KB | Output is correct |
7 | Correct | 0 ms | 3228 KB | Output is correct |
8 | Correct | 0 ms | 3228 KB | Output is correct |
9 | Correct | 0 ms | 3228 KB | Output is correct |
10 | Correct | 0 ms | 3228 KB | Output is correct |
11 | Correct | 0 ms | 3228 KB | Output is correct |
12 | Correct | 0 ms | 3228 KB | Output is correct |
13 | Correct | 0 ms | 3228 KB | Output is correct |
14 | Correct | 0 ms | 3360 KB | Output is correct |
15 | Correct | 0 ms | 3228 KB | Output is correct |
16 | Correct | 0 ms | 3228 KB | Output is correct |
17 | Correct | 0 ms | 3228 KB | Output is correct |
18 | Correct | 0 ms | 3228 KB | Output is correct |
19 | Correct | 0 ms | 3228 KB | Output is correct |
20 | Correct | 0 ms | 3228 KB | Output is correct |
21 | Correct | 0 ms | 3360 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 3228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |