이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
int n,m;
int porsor(int l1,int l2,int r1,int r2){
vector<int>por;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(i>=l1&&i<=l2&&j>=r1&&j<=r2){
por.push_back(i*n+j);
}
}
}
return add_or(por);
}
int porsxor(int l1,int l2,int r1,int r2){
vector<int>por;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(i>=l1&&i<=l2&&j>=r1&&j<=r2){
por.push_back(i*n+j);
}
}
}
return add_xor(por);
}
void construct_network(int H, int W, int K) {
n=H;
m=W;
std::vector<int> Ns;
int low=-1,high=W-1,mid,l1,r1,l2,r2;
while(high-low>1){
mid=(high+low)>>1;
int x=porsor(0,H-1,low+1,mid);
if(x==1){
high=mid;
}else{
low=mid;
}
}
l1=high;
low=-1,high=H-1;
while(high-low>1){
mid=(high+low)>>1;
int x=porsor(low+1,mid,0,W-1);
if(x==1){
high=mid;
}else{
low=mid;
}
}
r1=high;
low=-1,high=W-1;
while(high-low>1){
mid=(high+low)>>1;
int x=porsxor(0,H-1,low+1,mid);
if(l1<=mid&&l1>=low+1){
x^=1;
}
if(x==1){
high=mid;
}else{
low=mid;
}
}
l2=high;
low=-1,high=H-1;
while(high-low>1){
mid=(high+low)>>1;
int x=porsxor(low+1,mid,0,W-1);
if(r1<=mid&&r1>=low+1){
x^=1;
}
if(x==1){
high=mid;
}else{
low=mid;
}
}
r2=high;
if(abs(r2-r1)+abs(l1-l2)==K){
int x=add_not(0);
if(x==0){
add_or({0});
}
}else{
int x=add_not(0);
if(x==1){
add_or({0});
}
}
}
# | 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... |