// Author: Kajetan Ramsza
#include "vision.h"
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#ifdef DEBUG
auto& operator<<(auto& os, const pair<auto, auto> &p);
auto& operator<<(auto &os, const auto &v)
{ os<<"{"; for(auto it=begin(v);it!=end(v);++it) {
if(it != begin(v)) { os<<", "; } os<<(*it);
} return os<<"}"; }
auto& operator<<(auto &os, const pair<auto, auto> &p)
{ return os<<"("<<p.first<<", "<<p.second<<")"; }
void dbg_out(auto... x) { ((cerr<<' '<<x), ...) << endl; }
#define dbg(x...) cerr<<"("<<#x<<"):", dbg_out(x)
#else
#define dbg(...)
#endif
int ind = 0;
vi distance_vector(int l, int r) {
int n = r - l;
vi res(n);
for(int i=n-1;i>0;i--) {
rep(j,0,n-i)
add_and({l+j, l+j+i});
vi indicies(n-i);
iota(all(indicies), ind);
ind += n-i;
add_or(indicies);
res[i] = ind++;
}
vi query(res.begin()+1, res.end());
add_or(query); ind++;
add_not(ind - 1);
res[0] = ind++;
dbg(res);
return res;
}
void construct_network(int h, int w, int k) {
dbg(h, w, k);
ind += h * w;
rep(i,0,h) {
vi vec(w);
rep(j,0,w) vec[j] = i*w + j;
add_or(vec);
}
ind += h;
vi x = distance_vector(ind-h, ind);
rep(j,0,w) {
vi vec(h);
rep(i,0,h) vec[i] = i*w + j;
add_or(vec);
}
ind += w;
vi y = distance_vector(ind-w, ind);
int l = max(0, k-w+1);
int r = min(k+1, h);
rep(i,l,r)
add_and({x[i], y[k-i]});
vi res(r-l);
iota(all(res), ind);
add_or(res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
860 KB |
Output is correct |
4 |
Correct |
3 ms |
984 KB |
Output is correct |
5 |
Correct |
3 ms |
884 KB |
Output is correct |
6 |
Correct |
3 ms |
984 KB |
Output is correct |
7 |
Correct |
3 ms |
916 KB |
Output is correct |
8 |
Incorrect |
1 ms |
1240 KB |
WA in grader: Too many instructions |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1240 KB |
WA in grader: Too many instructions |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |