#include "vision.h"
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<cassert>
#include<stack>
#include<fstream>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
void construct_network(int H, int W, int K) {
vector<int> Ns;
int T=H+W-1;
for(int s=0;s<T;s++){
Ns.clear();
rep(i,H)rep(j,W)if(i+j==s)Ns.push_back(i*W+j);
add_or(Ns);
}
for(int s=0;s<T;s++){
Ns.clear();
rep(i,H)rep(j,W)if(i-j+W-1==s)Ns.push_back(i*W+j);
add_or(Ns);
}
int qid;
for(int s=0;s+K<T;s++){
Ns.clear();
Ns={H*W+s,H*W+s+K};
qid=add_and(Ns);
}
Ns.clear();
for(int s=H*W+2*T;s<=qid;s++)Ns.push_back(s);
int x_k=add_or(Ns);//xの距離がちょうどkなら1
for(int s=0;s+K<T;s++){
Ns.clear();
Ns={H*W+T+s,H*W+T+s+K};
qid=add_and(Ns);
}
Ns.clear();
for(int s=x_k+1;s<=qid;s++)Ns.push_back(s);
int y_k=add_or(Ns);//yの距離がちょうどkなら1
for(int s=0;s+K<T;s++){
Ns.clear();
for(int i=0;i<s;i++)Ns.push_back(i+H*W);
for(int i=s+K+1;i<T;i++)Ns.push_back(i+H*W);
qid=add_or(Ns);
}
Ns.clear();
for(int i=y_k+1;i<=qid;i++)Ns.push_back(i);
int x_kinai=add_and(Ns);//xの距離がK以下なら0
for(int s=0;s+K<T;s++){
Ns.clear();
for(int i=0;i<s;i++)Ns.push_back(i+T+H*W);
for(int i=s+K+1;i<T;i++)Ns.push_back(i+T+H*W);
qid=add_or(Ns);
}
Ns.clear();
for(int i=x_kinai+1;i<=qid;i++)Ns.push_back(i);
int y_kinai=add_and(Ns);//yの距離がK以下なら0
int x_kinai_rev=add_not(x_kinai);
int y_kinai_rev=add_not(y_kinai);
Ns.clear();
Ns.push_back(x_k);
Ns.push_back(y_kinai_rev);
int vl=add_and(Ns);
Ns.clear();
Ns.push_back(y_k);
Ns.push_back(x_kinai_rev);
int vr=add_and(Ns);
Ns.clear();
Ns.push_back(vl);
Ns.push_back(vr);
add_or(Ns);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:40:21: warning: 'qid' may be used uninitialized in this function [-Wmaybe-uninitialized]
for(int s=H*W+2*T;s<=qid;s++)Ns.push_back(s);
~^~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
1016 KB |
Output is correct |
2 |
Correct |
8 ms |
504 KB |
Output is correct |
3 |
Correct |
10 ms |
504 KB |
Output is correct |
4 |
Incorrect |
5 ms |
376 KB |
WA in grader: Instruction with no inputs |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Incorrect |
5 ms |
376 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
70 ms |
4344 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
13 ms |
760 KB |
Output is correct |
4 |
Correct |
15 ms |
1016 KB |
Output is correct |
5 |
Correct |
18 ms |
1016 KB |
Output is correct |
6 |
Correct |
13 ms |
1016 KB |
Output is correct |
7 |
Correct |
46 ms |
2556 KB |
Output is correct |
8 |
Correct |
37 ms |
2552 KB |
Output is correct |
9 |
Correct |
70 ms |
4456 KB |
Output is correct |
10 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |