#include "vision.h"
#include<bits/stdc++.h>
#define sz(x) ll(x.size())
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const ll MAX=1e6;
int n, m, k;
vector<int>s,p,q;
void construct_network(int H, int W, int K){
n=H;
m=W;
k=K;
if(n==1 || m==1){
if(n==1){
for(int j=0; j<m-1; j++){
s.pb(add_and({j,j+1}));
}
add_or(s);
return;
}
for(int i=0; i<n-1; i++){
s.pb(add_and({i,i+1}));
}
add_or(s);
return;
}
for(int j=0; j<m; j++){
for(int i=0; i<n; i++){
p.pb(i*m+j);
}
q.pb(add_or(p));
p.clear();
}
for(int i=0; i<sz(q)-1; i++){// 2 a 2 columnas
p.pb(q[i]);
p.pb(q[i+1]);
s.pb(add_and(p));
p.pop_back();
p.pop_back();
}
int pos=add_or(s);//si hay 2 juntitos columnas
s.clear();
p.clear();
q.clear();
// esto dbe xor 1 si estan en la misma fila
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
p.pb(i*m+j);
}
q.pb(add_or(p));
p.clear();
}
s.pb(add_xor(q));
s.pb(pos);
int a=add_and(s);
s.clear();
p.clear();
q.clear();
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
p.pb(i*m+j);
}
q.pb(add_or(p));
p.clear();
}
for(int i=0; i<sz(q)-1; i++){
p.pb(q[i]);
p.pb(q[i+1]);
s.pb(add_and(p));
p.pop_back();
p.pop_back();
}
pos=add_or(s);//si hay 2 juntitos en la misma fila
s.clear();
p.clear();
q.clear();
// esto dbe xor 1 si estan en la misma columna
for(int j=0; j<m; j++){
for(int i=0; i<n; i++){
p.pb(i*m+j);
}
q.pb(add_or(p));
p.clear();
}
s.pb(add_xor(q));
s.pb(pos);
int b=add_and(s);
add_or({b,a});
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
604 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1884 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
5 ms |
1116 KB |
Output is correct |
8 |
Correct |
5 ms |
1116 KB |
Output is correct |
9 |
Correct |
9 ms |
1884 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |