이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Comment!
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define all(x) x.begin(), x.end()
#define pb push_back
#define fi first
#define se second
const int maxn5 = 2e5 + 10;
vector <int> ns;
int h, w, lenh[maxn5], lenw[maxn5];
int isk(int st, int k, int n){
if(n - 1 < k)
return -1;
if(k == 0){
ns.clear();
for(int i = 0; i < n; i++)
ns.pb(i + st);
int cur = add_or(ns);
return add_not(cur);
}
//cout << "here " << st << ' ' << k << ' ' << n << endl;
ns.clear();
int st2 = -1;
int last = -1;
for(int i = 0; i + k < n; i++){
ns.clear();
ns = {i + st, i + k + st};
//cout << i + st << ' ' << i + k + st << ' ' << i << endl;
last = add_and(ns);
if(st2 == -1)
st2 = last;
}
//cout << "all here " << endl;
ns.clear();
for(int i = st2; i <= last; i++)
ns.pb(i);
return add_or(ns);
}
void construct_network(int H, int W, int k) {
h = H;
w = W;
int sth = -1, last = -1;
for(int i = 0; i < h; i++){
ns.clear();
for(int j = 0; j < w; j++)
ns.pb(i * w + j);
last = add_xor(ns);
if(sth == -1)
sth = last;
}
int stw = last + 1;
for(int j = 0; j < w; j++){
ns.clear();
for(int i = 0; i < h; i++)
ns.pb(i * w + j);
last = add_xor(ns);
}
for(int i = 0; i <= k; i++){
lenh[i] = isk(sth, i, h);
lenw[i] = isk(stw, i, w);
}
//cout << "done with h w" << endl;
int fr = -1;
last = -1;
for(int i = 0; i <= k; i++) if(lenh[i] != -1 && lenw[k - i] != -1){
ns.clear();
ns = {lenh[i], lenw[k - i]};
last = add_and(ns);
if(fr == -1)
fr = last;
}
ns.clear();
for(int i = fr; i <= last; i++)
ns.pb(i);
add_or(ns);
return;
}
# | 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... |