QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#671599 | #2674. Vision program | Pioneer# | 0 | 3ms | 4520kb | C++20 | 1.5kb | 2024-10-24 13:37:50 | 2024-10-24 13:37:51 |
answer
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int h,w,m;
int pos(int i,int j){
return i*w+j;
}
vector<int> cur;
void add(int pos){
int c=h*w;
vector<int> ncur;
for(int i=0;i<=8;i++){
ncur.pb(m+2*i);
add_xor({(i>=1?h*w:pos),c,cur[i]});
if(i==0){
add_and({pos,cur[i]});
}
else{
add_and({c,cur[i]});
}
c=m+2*i+1;
}
swap(ncur,cur);
m+=18;
}
void construct_network(int H, int W, int K){
if(H*W==2){
if(K==1)add_and({0,1});
else add_xor({0,1});
return;
}
h=H,w=W;
m=h*w+2;
add_and({0,1,2});
add_not(h*w);
for(int i=0;i<H;i++){
vector<int> n;
for(int j=0;j<W;j++){
n.pb(pos(i,j));
}
add_or(n);
m++;
}
add_and({m-h});
m++;
for(int i=1;i<H;i++){
add_xor({m-h,m-1});
m++;
}
add_not({m-1});
m++;
int lh=m,rh=m+H-1;
for(int i=0;i<h;i++){
add_and({m-1-i,m-i-h});
}
for(int i=0;i<W;i++){
vector<int> n;
for(int j=0;j<H;j++){
n.pb(pos(j,i));
}
add_or(n);
m++;
}
add_and({m-W});
m++;
for(int i=1;i<W;i++){
add_xor({m-w,m-1});
m++;
}
add_not({m-1});
m++;
int lw=m,rw=m+w-1;
for(int i=0;i<w;i++){
add_and({m-1-i,m-i-w});
m++;
}
for(int i=0;i<=8;i++){
cur.pb(m);
add_and({h*w});
m++;
}
for(int i=lh;i<=rh;i++){
add(i);
}
for(int i=0;i<=8;i++){
if(K>>i&1)add_xor({h*w+1,cur[i]});
else add_xor({h*w,cur[i]});
m++;
}
vector<int> ask;
for(int i=0;i<=8;i++){
ask.pb(m-i-1);
}
add_or(ask);
m++;
add_not(m-1);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4068kb
input:
c2675211-ade0-44b0-8c15-741dd835f3d2 1 3 1 -1
output:
b17553fd-ba5a-4140-836c-491f938c515b OK 54 0 3 0 1 2 3 3 1 3 0 1 2 0 1 5 3 6 0 2 7 7 1 1 0 1 1 1 1 1 2 0 1 8 2 2 9 11 2 2 10 12 3 13 0 2 14 12 0 2 14 12 0 2 14 12 0 1 3 0 1 3 0 1 3 0 1 3 0 1 3 0 1 3 0 1 3 0 1 3 0 1 3 2 3 8 3 18 0 2 8 18 2 3 3 28 19 0 2 28 19 2 3 3 30 20 0 2 30 20 2 3 3 32 21 0 2 32 ...
result:
wrong answer on inputs (0, 0), (0, 2), expected 0, but computed 1
Subtask #2:
score: 0
Wrong Answer
Test #19:
score: 0
Wrong Answer
time: 0ms
memory: 3784kb
input:
c2675211-ade0-44b0-8c15-741dd835f3d2 1 9 3 -1
output:
b17553fd-ba5a-4140-836c-491f938c515b OK 72 0 3 0 1 2 3 9 1 9 0 1 2 3 4 5 6 7 8 0 1 11 3 12 0 2 13 13 1 1 0 1 1 1 1 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 0 1 14 2 2 15 23 2 2 16 24 2 2 17 25 2 2 18 26 2 2 19 27 2 2 20 28 2 2 21 29 2 2 22 30 3 31 0 2 32 24 0 2 32 24 0 2 32 24 0 2 32 24 0 2 32 24 0 2...
result:
wrong answer on inputs (0, 0), (0, 1), expected 0, but computed 1
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Wrong Answer
Test #48:
score: 0
Wrong Answer
time: 1ms
memory: 3860kb
input:
c2675211-ade0-44b0-8c15-741dd835f3d2 1 199 1 -1
output:
b17553fd-ba5a-4140-836c-491f938c515b OK 642 0 3 0 1 2 3 199 1 199 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 8...
result:
wrong answer on inputs (0, 0), (0, 2), expected 0, but computed 1
Subtask #6:
score: 0
Wrong Answer
Test #70:
score: 0
Wrong Answer
time: 0ms
memory: 4068kb
input:
c2675211-ade0-44b0-8c15-741dd835f3d2 2 2 1 3 128 128 129 128 130 128 131
output:
b17553fd-ba5a-4140-836c-491f938c515b OK 72 0 3 0 1 2 3 4 1 2 0 1 1 2 2 3 0 1 6 2 2 7 8 3 9 0 2 10 9 0 2 9 8 1 2 0 2 1 2 1 3 0 1 11 2 2 12 13 3 14 0 2 15 14 0 2 15 14 0 1 4 0 1 4 0 1 4 0 1 4 0 1 4 0 1 4 0 1 4 0 1 4 0 1 4 2 3 11 4 18 0 2 11 18 2 3 4 28 19 0 2 28 19 2 3 4 30 20 0 2 30 20 2 3 4 32 21 0 ...
result:
wrong answer on inputs (0, 0), (1, 1), expected 0, but computed 1
Subtask #7:
score: 0
Wrong Answer
Test #101:
score: 0
Wrong Answer
time: 3ms
memory: 4520kb
input:
c2675211-ade0-44b0-8c15-741dd835f3d2 200 200 1 100 524 24804 34853 20956 34628 18830 29184 28919 32573 11364 24911 2226 5624 3715 30838 2206 17143 21162 27531 20198 27242 5007 12724 27160 32586 3535 7307 17015 25466 626 13891 9132 26194 9198 33073 815 7328 6938 21395 9489 30995 10804 21530 14698 394...
output:
b17553fd-ba5a-4140-836c-491f938c515b OK 4824 0 3 0 1 2 3 40000 1 200 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 8...
result:
wrong answer on inputs (126, 120), (176, 169), expected 0, but computed 1
Subtask #8:
score: 0
Skipped
Dependency #1:
0%