#include "vision.h"
#include <bits/stdc++.h>
#define pii pair<int,int>
#define x first
#define y second
#define MAXN 205
using namespace std;
int n,m,k,aho[2*MAXN],ahx[2*MAXN],awo[2*MAXN],awx[2*MAXN];
vector<int>ad[2*MAXN],ms[2*MAXN],hs,Ws;
vector<int>q[2];
void construct_network(int H, int W, int K) {
n=H; m=W; k=K;
for (int i=0;i<n;i++){
for (int j=0;j<m;j++){
ad[i+j].push_back(i*m+j);
ms[i-j+m-1].push_back(i*m+j);
}
}
int now=n*m-1;
for (int i=0;i<=n+m-2;i++){
vector<int>qus;
if (i+k<=n+m-2){
for (auto j:ad[i]) qus.push_back(j);
int before;
add_xor(qus); now++;
before=now; qus.clear();
for (auto j:ad[i+k]) qus.push_back(j);
add_or(qus); now++;
add_and({before,now}); now++;
q[0].push_back(now);
}
}
for (int i=0;i<=n+m-2;i++){
vector<int>qus;
if (i+k<=n+m-2){
for (auto j:ms[i]) qus.push_back(j);
int before;
add_xor(qus); now++;
before=now; qus.clear();
for (auto j:ms[i+k]) qus.push_back(j);
add_or(qus); now++;
add_and({before,now}); now++;
q[1].push_back(now);
}
}
for (int i=0;i<n;i++){
vector<int>qus;
for (int j=0;j<m;j++)
qus.push_back(i*m+j);
aho[i]=add_or(qus); now++;
qus.push_back(aho[i]);
ahx[i]=add_xor(qus); now++;
}
for (int i=0;i<m;i++){
vector<int>qus;
for (int j=0;j<n;j++)
qus.push_back(j*m+i);
awo[i]=add_or(qus); now++;
qus.push_back(aho[i]);
awx[i]=add_xor(qus); now++;
}
for (int i=0;i<n;i++){
vector<int>qus,qus1;
for (int j=i;j<min(m,i+k+1);j++){
qus.push_back(aho[i]);
qus1.push_back(ahx[i]);
}
int p1=add_or(qus); now++;
qus.push_back(p1);
int p2=add_xor(qus); now++;
qus1.push_back(p2);
add_or(qus1); now++;
hs.push_back(now);
}
for (int i=0;i<m;i++){
vector<int>qus,qus1;
for (int j=i;j<min(n,i+k+1);j++){
qus.push_back(awo[i]);
qus1.push_back(awx[i]);
}
int p1=add_or(qus); now++;
qus.push_back(p1);
int p2=add_xor(qus); now++;
qus1.push_back(p2);
add_or(qus1); now++;
Ws.push_back(now);
}
vector<int>qus;
// cout<<"Q : ";
for (auto i:q[0]){
qus.push_back(i);
// cout<<i<<" ";
}
// cout<<'\n'<<"Q : ";
for (auto i:q[1]){
qus.push_back(i);
// cout<<i<<" ";
}
/*
cout<<'\n';
cout<<"hs : ";
for (auto i:hs) cout<<i<<" ";
cout<<"\nWs : ";
for (auto i:Ws) cout<<i<<' ';
cout<<'\n';
*/
add_or(qus); now++;
int have=now;
qus.clear(); qus.push_back(have);
add_or(hs); now++;
qus.push_back(now);
add_or(Ws); now++;
qus.push_back(now);
add_and(qus);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
468 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
4300 KB |
on inputs (126, 120), (176, 169), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |