# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
246152 | 2020-07-08T10:08:20 Z | Nightlight | Dango Maker (JOI18_dango_maker) | C++14 | 1375 ms | 262144 KB |
#include <bits/stdc++.h> using namespace std; int N, M; vector<int> adj[3000001]; char A[3001][3001]; int id[3001][3001][2]; int match[3000001]; bitset<3000001> vis; int p; void edge(int u, int v) { // cout << u << " " << v << "\n"; adj[u].emplace_back(v); adj[v].emplace_back(u); } int kuhn(int u) { if(vis[u]) return 0; vis[u] = 1; for(int v : adj[u]) { if(match[v] == 0 || kuhn(match[v])) { match[u] = v; match[v] = u; return 1; } } return 0; } int main() { scanf("%d %d", &N, &M); for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) { scanf(" %c", &A[i][j]); } } for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) { if(A[i][j] == 'G') { if(A[i - 1][j] == 'R' && A[i + 1][j] == 'W') { id[i - 1][j][0] = ++p; id[i][j][0] = p; id[i + 1][j][0] = p; } if(A[i][j - 1] == 'R' && A[i][j + 1] == 'W') { id[i][j - 1][1] = ++p; id[i][j][1] = p; id[i][j + 1][1] = p; } } } } for(int i = 1; i <= N; i++) { for(int j = 1; j <= M; j++) { if(id[i][j][0] && id[i][j][1]) edge(id[i][j][0], id[i][j][1]); } } bool ok = 0; int cnt = 0; while(ok == 0) { ok = 1; vis = 0; for(int i = 1; i <= p; i++) { if(match[i] == 0 && kuhn(i)) { cnt++; ok = 0; } } } printf("%d\n", p - cnt); // cin >> N; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 47 ms | 71168 KB | Output is correct |
2 | Correct | 49 ms | 71160 KB | Output is correct |
3 | Correct | 49 ms | 71160 KB | Output is correct |
4 | Correct | 48 ms | 71168 KB | Output is correct |
5 | Correct | 47 ms | 71160 KB | Output is correct |
6 | Correct | 47 ms | 71136 KB | Output is correct |
7 | Correct | 46 ms | 71168 KB | Output is correct |
8 | Correct | 46 ms | 71168 KB | Output is correct |
9 | Correct | 48 ms | 71160 KB | Output is correct |
10 | Correct | 47 ms | 71160 KB | Output is correct |
11 | Correct | 48 ms | 71160 KB | Output is correct |
12 | Correct | 45 ms | 71168 KB | Output is correct |
13 | Correct | 46 ms | 71160 KB | Output is correct |
14 | Correct | 46 ms | 71160 KB | Output is correct |
15 | Correct | 48 ms | 71160 KB | Output is correct |
16 | Correct | 45 ms | 71288 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 47 ms | 71168 KB | Output is correct |
2 | Correct | 49 ms | 71160 KB | Output is correct |
3 | Correct | 49 ms | 71160 KB | Output is correct |
4 | Correct | 48 ms | 71168 KB | Output is correct |
5 | Correct | 47 ms | 71160 KB | Output is correct |
6 | Correct | 47 ms | 71136 KB | Output is correct |
7 | Correct | 46 ms | 71168 KB | Output is correct |
8 | Correct | 46 ms | 71168 KB | Output is correct |
9 | Correct | 48 ms | 71160 KB | Output is correct |
10 | Correct | 47 ms | 71160 KB | Output is correct |
11 | Correct | 48 ms | 71160 KB | Output is correct |
12 | Correct | 45 ms | 71168 KB | Output is correct |
13 | Correct | 46 ms | 71160 KB | Output is correct |
14 | Correct | 46 ms | 71160 KB | Output is correct |
15 | Correct | 48 ms | 71160 KB | Output is correct |
16 | Correct | 45 ms | 71288 KB | Output is correct |
17 | Correct | 47 ms | 71160 KB | Output is correct |
18 | Correct | 47 ms | 71160 KB | Output is correct |
19 | Correct | 47 ms | 71160 KB | Output is correct |
20 | Correct | 47 ms | 71164 KB | Output is correct |
21 | Correct | 46 ms | 71160 KB | Output is correct |
22 | Correct | 47 ms | 71160 KB | Output is correct |
23 | Correct | 47 ms | 71168 KB | Output is correct |
24 | Correct | 46 ms | 71160 KB | Output is correct |
25 | Correct | 46 ms | 71160 KB | Output is correct |
26 | Correct | 46 ms | 71160 KB | Output is correct |
27 | Correct | 47 ms | 71160 KB | Output is correct |
28 | Correct | 46 ms | 71416 KB | Output is correct |
29 | Correct | 46 ms | 71160 KB | Output is correct |
30 | Correct | 46 ms | 71160 KB | Output is correct |
31 | Correct | 48 ms | 71160 KB | Output is correct |
32 | Correct | 48 ms | 71160 KB | Output is correct |
33 | Correct | 48 ms | 71208 KB | Output is correct |
34 | Correct | 55 ms | 71296 KB | Output is correct |
35 | Correct | 49 ms | 71160 KB | Output is correct |
36 | Correct | 46 ms | 71160 KB | Output is correct |
37 | Correct | 48 ms | 71160 KB | Output is correct |
38 | Correct | 53 ms | 71160 KB | Output is correct |
39 | Correct | 46 ms | 71168 KB | Output is correct |
40 | Correct | 46 ms | 71160 KB | Output is correct |
41 | Correct | 46 ms | 71160 KB | Output is correct |
42 | Correct | 46 ms | 71160 KB | Output is correct |
43 | Correct | 47 ms | 71160 KB | Output is correct |
44 | Correct | 47 ms | 71288 KB | Output is correct |
45 | Correct | 46 ms | 71296 KB | Output is correct |
46 | Correct | 48 ms | 71272 KB | Output is correct |
47 | Correct | 48 ms | 71296 KB | Output is correct |
48 | Correct | 47 ms | 71160 KB | Output is correct |
49 | Correct | 46 ms | 71288 KB | Output is correct |
50 | Correct | 47 ms | 71160 KB | Output is correct |
51 | Correct | 46 ms | 71288 KB | Output is correct |
52 | Correct | 47 ms | 71168 KB | Output is correct |
53 | Correct | 47 ms | 71160 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 47 ms | 71168 KB | Output is correct |
2 | Correct | 49 ms | 71160 KB | Output is correct |
3 | Correct | 49 ms | 71160 KB | Output is correct |
4 | Correct | 48 ms | 71168 KB | Output is correct |
5 | Correct | 47 ms | 71160 KB | Output is correct |
6 | Correct | 47 ms | 71136 KB | Output is correct |
7 | Correct | 46 ms | 71168 KB | Output is correct |
8 | Correct | 46 ms | 71168 KB | Output is correct |
9 | Correct | 48 ms | 71160 KB | Output is correct |
10 | Correct | 47 ms | 71160 KB | Output is correct |
11 | Correct | 48 ms | 71160 KB | Output is correct |
12 | Correct | 45 ms | 71168 KB | Output is correct |
13 | Correct | 46 ms | 71160 KB | Output is correct |
14 | Correct | 46 ms | 71160 KB | Output is correct |
15 | Correct | 48 ms | 71160 KB | Output is correct |
16 | Correct | 45 ms | 71288 KB | Output is correct |
17 | Correct | 47 ms | 71160 KB | Output is correct |
18 | Correct | 47 ms | 71160 KB | Output is correct |
19 | Correct | 47 ms | 71160 KB | Output is correct |
20 | Correct | 47 ms | 71164 KB | Output is correct |
21 | Correct | 46 ms | 71160 KB | Output is correct |
22 | Correct | 47 ms | 71160 KB | Output is correct |
23 | Correct | 47 ms | 71168 KB | Output is correct |
24 | Correct | 46 ms | 71160 KB | Output is correct |
25 | Correct | 46 ms | 71160 KB | Output is correct |
26 | Correct | 46 ms | 71160 KB | Output is correct |
27 | Correct | 47 ms | 71160 KB | Output is correct |
28 | Correct | 46 ms | 71416 KB | Output is correct |
29 | Correct | 46 ms | 71160 KB | Output is correct |
30 | Correct | 46 ms | 71160 KB | Output is correct |
31 | Correct | 48 ms | 71160 KB | Output is correct |
32 | Correct | 48 ms | 71160 KB | Output is correct |
33 | Correct | 48 ms | 71208 KB | Output is correct |
34 | Correct | 55 ms | 71296 KB | Output is correct |
35 | Correct | 49 ms | 71160 KB | Output is correct |
36 | Correct | 46 ms | 71160 KB | Output is correct |
37 | Correct | 48 ms | 71160 KB | Output is correct |
38 | Correct | 53 ms | 71160 KB | Output is correct |
39 | Correct | 46 ms | 71168 KB | Output is correct |
40 | Correct | 46 ms | 71160 KB | Output is correct |
41 | Correct | 46 ms | 71160 KB | Output is correct |
42 | Correct | 46 ms | 71160 KB | Output is correct |
43 | Correct | 47 ms | 71160 KB | Output is correct |
44 | Correct | 47 ms | 71288 KB | Output is correct |
45 | Correct | 46 ms | 71296 KB | Output is correct |
46 | Correct | 48 ms | 71272 KB | Output is correct |
47 | Correct | 48 ms | 71296 KB | Output is correct |
48 | Correct | 47 ms | 71160 KB | Output is correct |
49 | Correct | 46 ms | 71288 KB | Output is correct |
50 | Correct | 47 ms | 71160 KB | Output is correct |
51 | Correct | 46 ms | 71288 KB | Output is correct |
52 | Correct | 47 ms | 71168 KB | Output is correct |
53 | Correct | 47 ms | 71160 KB | Output is correct |
54 | Correct | 46 ms | 71160 KB | Output is correct |
55 | Correct | 54 ms | 81272 KB | Output is correct |
56 | Correct | 55 ms | 71288 KB | Output is correct |
57 | Correct | 54 ms | 85240 KB | Output is correct |
58 | Correct | 133 ms | 87544 KB | Output is correct |
59 | Correct | 748 ms | 159756 KB | Output is correct |
60 | Correct | 748 ms | 159736 KB | Output is correct |
61 | Correct | 761 ms | 159736 KB | Output is correct |
62 | Correct | 47 ms | 71288 KB | Output is correct |
63 | Correct | 804 ms | 159704 KB | Output is correct |
64 | Runtime error | 1375 ms | 262144 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
65 | Halted | 0 ms | 0 KB | - |