#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define lowb(x) (x&(-x))
#define ALL(_x) _x.begin(),_x.end()
#define pii pair<int,int>
#define f first
#define s second
#define SORT_UNIQUE(x) sort(ALL(x)),x.erase(unique(ALL(x)),x.end())
const int maxn=1e3+5;
#define ll long long
vector<int> a[maxn],b[maxn];
int n,m;
int aa[maxn],bb[maxn];
int pa[maxn],pb[maxn];
int leq(int x){
vector<int> az,bz;
REP1(i,n+m-2){
if(i>=x+1) az.pb(add_and({aa[i],add_not(pa[i-x-1]),pa[i-1]})),bz.pb(add_and({bb[i],add_not(pb[i-x-1]),pb[i-1]}));
else az.pb(add_and({aa[i],pa[i-1]})),bz.pb(add_and({bb[i],pb[i-1]}));
}
return add_and({add_or(az),add_or(bz)});
}
void construct_network(int H, int W, int K) {
n=H,m=W;
REP(i,n){
REP(j,m){
a[i+j].pb(i*m+j);
b[i-j+m-1].pb(i*m+j);
}
}
REP(i,n+m-1){
aa[i]=add_or(a[i]);
bb[i]=add_or(b[i]);
}
pa[0]=aa[0],pb[0]=bb[0];
REP1(i,n+m-2){
pa[i]=add_or({pa[i-1],aa[i]});
pb[i]=add_or({pb[i-1],bb[i]});
}
int a=leq(K),b=leq(K-1);
add_and({a,add_not(b)});
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
356 KB |
Output is correct |
6 |
Incorrect |
1 ms |
340 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
356 KB |
Output is correct |
6 |
Incorrect |
1 ms |
340 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
356 KB |
Output is correct |
6 |
Incorrect |
1 ms |
340 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
356 KB |
Output is correct |
6 |
Incorrect |
1 ms |
340 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
596 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
480 KB |
Output is correct |
4 |
Correct |
2 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
596 KB |
Output is correct |
6 |
Correct |
2 ms |
596 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
2 ms |
476 KB |
Output is correct |
9 |
Correct |
2 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
3 ms |
480 KB |
Output is correct |
12 |
Correct |
1 ms |
484 KB |
Output is correct |
13 |
Correct |
2 ms |
480 KB |
Output is correct |
14 |
Correct |
2 ms |
468 KB |
Output is correct |
15 |
Correct |
2 ms |
596 KB |
Output is correct |
16 |
Correct |
2 ms |
596 KB |
Output is correct |
17 |
Correct |
2 ms |
468 KB |
Output is correct |
18 |
Correct |
1 ms |
468 KB |
Output is correct |
19 |
Correct |
1 ms |
468 KB |
Output is correct |
20 |
Correct |
1 ms |
468 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
340 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
2000 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Correct |
3 ms |
732 KB |
Output is correct |
5 |
Correct |
2 ms |
596 KB |
Output is correct |
6 |
Correct |
2 ms |
612 KB |
Output is correct |
7 |
Correct |
6 ms |
1192 KB |
Output is correct |
8 |
Correct |
9 ms |
1240 KB |
Output is correct |
9 |
Correct |
10 ms |
2000 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
356 KB |
Output is correct |
6 |
Incorrect |
1 ms |
340 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |