#include "vision.h"
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
vector<int> g[200*200+5];
vector<pii> dir{{-1, -1}, {-1, 1}, {1, -1}, {1, 1}};
int vis[200*200+5];
int col[200*200+5];
int colcnt[2];
void dfs(int v){
vis[v] = 1;
colcnt[col[v]]++;
for(auto u : g[v]){
if(vis[u] == 0){
col[u] = col[v^1];
dfs(u);
}
assert(col[u] != col[v]);
}
}
void construct_network(int H, int W, int K){
vector<int> finalcomp;
for(int i = 0; i < H; ++i)
for(int j = 0; j < W; ++j){
for(int k = 0; k <= K; ++k)
for(auto u : dir){
int i1 = i + u.ff*k;
int j1 = j + u.ss*(K-k);
if(i1 >= 0 && i1 < H && j1 >= 0 && j1 < W)
g[i*W+j].pb(i1*W+j1);
}
}
for(int i = 0; i < H*W; ++i)
if(vis[i] == 0)
dfs(i);
int maincol = 0;
if(colcnt[1] < colcnt[0])
maincol = 1;
for(int i = 0; i < H*W; ++i)
if(col[i] == maincol && g[i].size())
finalcomp.pb(add_and({i, add_or(g[i])}));
add_or(finalcomp);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
2432 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
2432 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
2432 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
2432 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
2432 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
2432 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
15 ms |
6304 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
2432 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |