#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;
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));
}
add_or({solve(rows,cols),solve(cols,rows)});
return;
}
Compilation message
vision.cpp: In function 'int solve(std::vector<int>, std::vector<int>)':
vision.cpp:53:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for(i=0;i+1<a.size();i++){
| ~~~^~~~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:62:10: warning: unused variable 'k' [-Wunused-variable]
62 | int i,j,k;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
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 |
Correct |
7 ms |
1108 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |