이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include <vector>
using namespace std;
int L[401],R[401],SL[401],SR[401];
int check(int H, int W, int K ){
vector<int> dl[401],dr[401];
vector <int> tmpl,tmpr,tmp;
int i,j,ind,d;
for (i=0;i<H;i++)
for (j=0;j<W;j++){
ind=i*W+j;
dr[i+j].push_back(ind);
dl[i-j+W-1].push_back(ind);
}
L[0]=SL[0]=add_or(dl[0]); R[0]=SR[0]=add_or(dr[0]);
for (d=1;d<=W+H-2;d++) {
L[d]=add_or(dl[d]);
R[d]=add_or(dr[d]);
tmp.push_back(L[d]); tmp.push_back(SL[d-1]); SL[d]=add_or(tmp);
tmp.clear();
tmp.push_back(R[d]); tmp.push_back(SR[d-1]); SR[d]=add_or(tmp);
tmp.clear();
}
for (d=K;d<=W+H-2;d++){
tmp.push_back(L[d]); tmp.push_back(SL[d-K]);
tmpl.push_back(add_and(tmp));
tmp.clear();
tmp.push_back(R[d]); tmp.push_back(SR[d-K]);
tmpr.push_back(add_and(tmp));
tmp.clear();
}
tmp.push_back(add_or(tmpl)); tmp.push_back(add_or(tmpr));
int ans=add_or(tmp);
return ans;
}
void construct_network(int H, int W, int K) {
vector <int> tmp;
int a=check(H,W,K);
if (K<H+W-2) {
int b=check(H,W,K+1);
tmp.push_back(a); tmp.push_back(b);
add_xor(tmp);
}
} //network
/*
2 3 3
0 0 0 1
0 0 0 2
0 0 1 0
0 0 1 1
0 0 1 2
0 1 0 2
0 1 1 0
0 1 1 1
0 1 1 2
0 2 1 0
0 2 1 1
0 2 1 2
1 0 1 1
1 0 1 2
1 1 1 2
-1
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |