#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;
vector<int>ad[2*MAXN],ms[2*MAXN];
int q[2*MAXN][2],s[2*MAXN],l1[2*MAXN],l2[2*MAXN];
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);
for (auto j:ad[i+k]) qus.push_back(j);
add_or(qus); now++;
qus.push_back(now);
add_xor(qus); now++;
q[i][0]=now;
}
}
for (int i=0;i<=n+m-2;i++){
vector<int>qus;
qus=ad[i];
add_or(qus); now++;
qus=ad[i]; qus.push_back(now);
add_xor(qus); now++;
l1[i]=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);
for (auto j:ms[i+k]) qus.push_back(j);
add_or(qus); now++;
qus.push_back(now);
add_xor(qus); now++;
q[i][1]=now;
}
}
for (int i=0;i<=n+m-2;i++){
vector<int>qus;
qus=ms[i];
add_or(qus); now++;
qus=ms[i]; qus.push_back(now);
add_xor(qus); now++;
l2[i]=now;
}
for (int i=0;i<k;i++){
vector<int>qus;
for (int j=i;j<n+m;j+=k){
if (q[i][1])
qus.push_back(q[i][1]);
}
if (qus.empty()) continue;
add_or(qus); now++;
s[i]=now;
}
vector<int>ans;
for (int i=0;i<=n+m-2;i++){
vector<int>qus;
if (!q[i][0]) continue;
qus.push_back(q[i][0]);
for (int j=0;j<k;j++)
if (s[j]) qus.push_back(s[j]);
add_or(qus); now++;
ans.push_back(now);
}
vector<int>qus;
for (auto i:ans)
qus.push_back(i);
add_or(qus); now++;
/*
for (int i=0;i<n+m;i++){
cout<<"q : "<<q[i][0]<<" "<<q[i][1]<<"\n";
}
cout<<"l1 : ";
for (int i=0;i<n+m;i++)
cout<<l1[i]<<" ";
cout<<'\n';
cout<<"l2 : ";
for (int i=0;i<n+m;i++)
cout<<l2[i]<<" ";
cout<<'\n';
for (int i=0;i<n+m;i++)
cout<<s[i]<<" ";
cout<<'\n';
for (auto i:ans)
cout<<i<<" ";
cout<<'\n';
*/
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Correct |
2 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
468 KB |
Output is correct |
10 |
Correct |
2 ms |
468 KB |
Output is correct |
11 |
Correct |
2 ms |
468 KB |
Output is correct |
12 |
Correct |
2 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
468 KB |
Output is correct |
16 |
Correct |
2 ms |
468 KB |
Output is correct |
17 |
Correct |
2 ms |
468 KB |
Output is correct |
18 |
Correct |
2 ms |
468 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
5676 KB |
on inputs (96, 130), (143, 84), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |