#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plll;
typedef pair<pll,pll> ppll;
typedef long double ld;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fst first
#define snd second
#define ins insert
#define pb push_back
template< typename T,typename V>ostream &operator<< (ostream &out,const pair<T,V> x){ out << "{" << x.fst << " : " << x.snd << "}"; return out;}template< typename T>ostream &operator<< (ostream &out,const set<T> x){ for(auto &it : x){ out << it << " "; } return out;}template< typename T>ostream &operator<< (ostream &out,const multiset<T> x){ for(auto &it : x){ out << it << " "; } return out;}template< typename T,typename V>ostream &operator<< (ostream &out,const map<T,V> x){ for(auto &it : x){ out << "[" << it.fst << "]" << " = " << it.snd << "\n"; } return out;}template< typename T>ostream &operator<< (ostream &out,const vector<T> x){ for(int i = 0;i < x.size() - 1; ++i){ out << x[i] << " "; } out << x.back(); return out;}template< typename T>ostream &operator<< (ostream &out,const vector<vector<T> > x){ for(int i = 0;i < x.size() - 1; ++i){ out << "[" << i << "]" << " = {" << x[i] << "}\n"; } out << "[" << x.size() - 1 << "]" << " = {" << x.back() << "}\n"; return out;}
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
const ll INF = 1e9;
int dist(int x1,int y1,int x2,int y2){
return abs(x2 - x1) + abs(y2 - y1);
}
map<ll,bool> used;
//void construct_network(int H, int W, int K) {
// vector<int> g;
// int id = H * W;
// for(int i = 0;i < H; ++i){
// for(int j = 0;j < W; ++j){
// vector<int> Ns;
// for(int add = 0;add <= K; ++add){
// for(int x=-1;x <=1;x +=2)
// for(int y=-1;y <=1;y +=2){
// int i1 = i + x * add,j1 = j + y * (K - add);
// if(i1 >= H)continue;
// if(i1 < 0)continue;
// if(j1 >= W)continue;
// if(j1 < 0)continue;
// if(used.find((i * W + j) * INF + (i1 * W + j1)) != used.end())continue;
// if(used.find((i1 * W + j1) * INF + (i * W + j)) != used.end())continue;
// if(dist(i,j,i1,j1) == K){
// used[(i * W + j) * INF + (i1 * W + j1)] = true;
// Ns.pb(i1 * W + j1);
// }
// }
// }
// if(Ns.empty())continue;
// add_or(Ns);
// add_and({i * W + j,id});
// ++id;
// g.pb(id);
// ++id;
// }
// }
// add_or(g);
//}
void construct_network(int H, int W, int K) {
vector<int> x,y;
int id = H * W;
for(int i = 0;i < H; ++i){
vector<int> v;
for(int j = 0;j < W; ++j){
v.pb(i * W + j);
}
add_or(v);
x.pb(id);
++id;
}
for(int i = 0;i < W; ++i){
vector<int> v;
for(int j = 0;j < H; ++j){
v.pb(j * W + i);
}
add_or(v);
y.pb(id);
++id;
}
vector<int> a,b;
for(int i = 1;i < x.size(); ++i){
add_and({x[i - 1],x[i]});
a.pb(id);
++id;
}
for(int i = 1;i < y.size(); ++i){
add_and({y[i - 1],y[i]});
b.pb(id);
++id;
}
add_or(a);//id
add_xor(y);
add_and({id,id + 1});
add_or(b);
add_xor(x);
add_and({id + 3,id + 4});
add_or({id + 2,id + 5});
// add_or(b);
// add_and({id,id + 1});
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:79:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1;i < x.size(); ++i){
~~^~~~~~~~~~
vision.cpp:84:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1;i < y.size(); ++i){
~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
380 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
1148 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
4 |
Correct |
7 ms |
504 KB |
Output is correct |
5 |
Incorrect |
5 ms |
376 KB |
WA in grader: Instruction with no inputs |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |