#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#ifdef dremix
#define p(x) cerr<<#x<<" = "<<x<<endl;
#define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl;
#define pp(x) cerr<<#x<<" = "<<x.F<<"-"<<x.S<<endl;
#define pv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v<<", ";cerr<<"}"<<endl;
#define ppv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v.F<<"-"<<v.S<<", ";cerr<<"}"<<endl;
#else
#define p(x) {}
#define p2(x,y) {}
#define pp(x) {}
#define pv(x) {}
#define ppv(x) {}
#endif
//const int N = 3e5+5;
const int MOD = 1e9+7;
const ll INF = 1e18+5;
int N,M;
int foo(pi x){
return x.F*M+x.S;
}
pi oof(int x){
return {x/M,x%M};
}
int di[] = {1,0,-1,0};
int dj[] = {0,1,0,-1};
void print(queue<pi> q){
#ifdef dremix
while(!q.empty()){
pp(oof(q.front().F))
q.pop();
}
#endif
}
int solve(vector<int> a, vector<int> b){
int i;
if(a.size() < 2)return -1;
vector<int> duo;
for(i=0;i+1<a.size();i++){
duo.push_back(add_and({a[i],a[i+1]}));
}
int p1 = add_or(duo);
int p2 = add_xor(b);
return add_and({p1,p2});
}
void construct_network(int n, int m, int K) {
int i,j,k;
N = n;
M = m;
///sub7:
/// 2 consecutive OR columns with result = 1 + ONLY 1 OR row with result = 1
/// 2 consecutive OR rows with result = 1 + ONLY 1 OR column with result = 1
vector<int> rows,cols;
int idx = 0;
for(i=0;i<n;i++){
vector<int> curr;
for(j=0;j<m;j++){
curr.push_back(idx++);
}
rows.push_back(add_or(curr));
}
for(j=0;j<m;j++){
vector<int> curr;
idx = j;
for(i=0;i<n;i++){
curr.push_back(idx);
idx += m;
}
cols.push_back(add_or(curr));
}
int p1 = solve(rows,cols);
int p2 = solve(cols,rows);
vector<int> temp;
if(p1 != -1)temp.push_back(p1);
if(p2 != -1)temp.push_back(p2);
add_and(temp);
return;
}
Compilation message
vision.cpp: In function 'int solve(std::vector<int>, std::vector<int>)':
vision.cpp:54:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | for(i=0;i+1<a.size();i++){
| ~~~^~~~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:63:10: warning: unused variable 'k' [-Wunused-variable]
63 | int i,j,k;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 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 |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 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 |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 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 |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 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 |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 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 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
1108 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |