Submission #152167

#TimeUsernameProblemLanguageResultExecution timeMemory
152167stefdascaVision Program (IOI19_vision)C++14
44 / 100
1070 ms2416 KiB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
void construct_network(int H, int W, int K)
{
    bool sk[302][302];
    int qu1[302][302], qu2[302][302];
    memset(sk, 0, sizeof(sk));
    memset(qu1, 0, sizeof(qu1));
    memset(qu2, 0, sizeof(qu2));
    int query_number = H * W;
    int z = 0;
    for(int i = 0; i < H; ++i)
        for(int j = 0; j < W; ++j)
        {
            vector<int>pz;
            for(int p = 0; p <= i; ++p)
                for(int z = 0; z < W; ++z)
                    if(abs(i - p) + abs(j - z) == K)
                        pz.push_back({p * W + z});
            if(!pz.size() || z >= 3333)
                sk[i][j] = 1;
            else
                ++z, qu1[i][j] = query_number, add_or(pz), ++query_number;
        }
    for(int i = 0; i < H; ++i)
        for(int j = 0; j < W; ++j)
        {
            if(sk[i][j])
                continue;
            add_and({i * W + j});
            qu2[i][j] = query_number;
            ++query_number;
        }
    vector<int>p;
    for(int i = 0; i < H; ++i)
        for(int j = 0; j < W; ++j)
            if(!sk[i][j])
                p.push_back(query_number), add_and({qu1[i][j], qu2[i][j]}), ++query_number;
    add_or(p);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...