Submission #152203

# Submission time Handle Problem Language Result Execution time Memory
152203 2019-09-06T18:51:09 Z stefdasca Vision Program (IOI19_vision) C++14
0 / 100
14 ms 1548 KB
#include "vision.h"
#include<bits/stdc++.h>

using namespace std;

void construct_network(int H, int W, int K)
{
    int query_number = H * W - 1;
    vector<int>mn, sc;
    for(int i = H - 1; i >= 0; --i)
    {
        vector<int>pz;
        for(int a = i, b = 0; a < H && b < W; ++a, ++b)
            pz.push_back(a * W + b);
        if(i == H-1)
            add_xor(pz), ++query_number;
        else
            add_xor({query_number, add_xor(pz)}), query_number += 2;
        mn.push_back(query_number);
    }
    for(int i = 1; i < W; ++i)
    {
        vector<int>pz;
        for(int a = 0, b = i; a < H && b < W; ++a, ++b)
            pz.push_back(a * W + b);
        add_xor({query_number, add_xor(pz)}), query_number += 2;
        mn.push_back(query_number);
    }
    for(int i = 0; i < W; ++i)
    {
        vector<int>pz;
        for(int a = 0, b = i; a < H && b >= 0; ++a, --b)
            pz.push_back(a * W + b);
        if(i == 0)
            add_xor(pz), ++query_number;
        else
            add_xor({query_number, add_xor(pz)}), query_number += 2;
        sc.push_back(query_number);
    }
    for(int i = 1; i < H; ++i)
    {
        vector<int>pz;
        for(int a = i, b = W - 1; a < H && b >= 0; ++a, --b)
            pz.push_back(a * W + b);
        add_xor({query_number, add_xor(pz)});
        query_number += 2;
        sc.push_back(query_number);
    }
    vector<int>k1, k2;
    vector<int>kplus1, kplus2;
    for(int i = K; i < mn.size(); ++i)
    {
        if(i + 1 < mn.size())
        {
            add_xor({add_and({mn[i-K], mn[i]}), add_and({mn[i-K], mn[i+1]})});
            query_number += 3;
        }
        else
        {
            add_xor({add_and({mn[i-K], mn[i]})});
            query_number += 2;
        }
        k1.push_back(query_number);
    }
    for(int i = K; i < sc.size(); ++i)
    {
        if(i + 1 < sc.size())
        {
            add_xor({add_and({sc[i-K], sc[i]}), add_and({sc[i-K], sc[i+1]})});
            query_number += 3;
        }
        else
        {
            add_xor({add_and({sc[i-K], sc[i]})});
            query_number += 2;
        }
        k2.push_back(query_number);
    }
    ++K;
    for(int i = K; i < mn.size(); ++i)
    {
        if(i + 1 < mn.size())
        {
            add_xor({add_and({mn[i-K], mn[i]}), add_and({mn[i-K], mn[i+1]})});
            query_number += 3;
        }
        else
        {
            add_xor({add_and({mn[i-K], mn[i]})});
            query_number += 2;
        }
        kplus1.push_back(query_number);
    }
    for(int i = K; i < sc.size(); ++i)
    {
        if(i + 1 < sc.size())
        {
            add_xor({add_and({sc[i-K], sc[i]}), add_and({sc[i-K], sc[i+1]})});
            query_number += 3;
        }
        else
        {
            add_xor({add_and({sc[i-K], sc[i]})});
            query_number += 2;
        }
        kplus2.push_back(query_number);
    }
    add_and({add_or(k1), add_or(k2), add_not(add_or(kplus1)), add_not(add_or(kplus2))});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:51:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = K; i < mn.size(); ++i)
                    ~~^~~~~~~~~~~
vision.cpp:53:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(i + 1 < mn.size())
            ~~~~~~^~~~~~~~~~~
vision.cpp:65:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = K; i < sc.size(); ++i)
                    ~~^~~~~~~~~~~
vision.cpp:67:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(i + 1 < sc.size())
            ~~~~~~^~~~~~~~~~~
vision.cpp:80:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = K; i < mn.size(); ++i)
                    ~~^~~~~~~~~~~
vision.cpp:82:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(i + 1 < mn.size())
            ~~~~~~^~~~~~~~~~~
vision.cpp:94:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = K; i < sc.size(); ++i)
                    ~~^~~~~~~~~~~
vision.cpp:96:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(i + 1 < sc.size())
            ~~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 632 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1548 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -