#include "vision.h"
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
#include <string>
// #include <iostream>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;
int h,w;
int convert(pi a){return (a.F*w)+a.S;}
int dis(pi a,pi b){return abs(a.F-b.F) + abs(a.S-b.S);}
vi last;
vvi asked(50000,vi(50000,0));
void proc(int pos,vi arr){
// cout << pos << " ";
// for(int a:arr)cout << a << " ";
// cout << endl;
int or_pos= add_or(arr);
vi arr2 = {pos,or_pos};
int and_pos = add_and(arr2);
last.pb(and_pos);
}
void construct_network(int H_, int W_, int K_) {
h = H_;w = W_;
// cout << endl;
FOR(i,0,h){
FOR(j,0,w){
vi arr;
FOR(k,0,h){
FOR(l,0,w){
// cout << i << " " << j << " - " << k << " " << l << " - " << dis({i,j},{k,l}) << endl;
if(dis({i,j},{k,l}) == K_ && asked[convert({i,j})][convert({k,l})] == 0){
asked[convert({i,j})][convert({k,l})] = 1;
asked[convert({k,l})][convert({i,j})] = 1;
arr.pb(convert({k,l}));
}
}
}
if(!arr.empty())proc(convert({i,j}),arr);
}
}
int ans = add_or(last);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:79:6: warning: unused variable 'ans' [-Wunused-variable]
79 | int ans = add_or(last);
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
353 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
353 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
353 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
353 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
372 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
350 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
363 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
353 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |