Submission #588019

# Submission time Handle Problem Language Result Execution time Memory
588019 2022-07-02T16:11:14 Z ogibogi2004 Vision Program (IOI19_vision) C++14
0 / 100
17 ms 1488 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;

void construct_network(int H, int W, int K) {
    vector<int>table;
    for(int i=0;i<H*W;i++)table.push_back(i);
    vector<int>diag1,diag2;
    for(int s=0;s<H+W-1;s++)
    {
        vector<int>v;
        for(int i=0;i<H;i++)
        {
            for(int j=0;j<W;j++)
            {
                if(i+j==s)v.push_back(i*W+j);
            }
        }
        if(v.size()!=0)diag1.push_back(add_or(v));
    }
    for(int s=-(W-1);s<H;s++)
    {
        vector<int>v;
        for(int i=0;i<H;i++)
        {
            for(int j=0;j<W;j++)
            {
                if(i-j==s)v.push_back(i*W+j);
            }
        }
        if(v.size()!=0)diag2.push_back(add_or(v));
    }
    vector<int>distsK,distsMoreThanK;
    for(int i=0;i<diag1.size()-K;i++)
    {
        distsK.push_back(add_and({diag1[i],diag1[i+K]}));
        for(int j=i+K+1;j<diag1.size();j++)
        {
            distsMoreThanK.push_back(add_and({diag1[i],diag1[j]}));
        }
    }
    for(int i=0;i<diag2.size()-K;i++)
    {
        distsK.push_back(add_and({diag2[i],diag2[i+K]}));
        for(int j=i+K+1;j<diag2.size();j++)
        {
            distsMoreThanK.push_back(add_and({diag2[i],diag2[j]}));
        }
    }
    if(distsK.size()==0)
    {
        add_and(table);
        return;
    }
    if(distsMoreThanK.size()==0)
    {
        add_or(distsK);
    }
    add_and({add_not(add_or(distsMoreThanK)),add_or(distsK)});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:34:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i=0;i<diag1.size()-K;i++)
      |                 ~^~~~~~~~~~~~~~~
vision.cpp:37:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for(int j=i+K+1;j<diag1.size();j++)
      |                         ~^~~~~~~~~~~~~
vision.cpp:42:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for(int i=0;i<diag2.size()-K;i++)
      |                 ~^~~~~~~~~~~~~~~
vision.cpp:45:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         for(int j=i+K+1;j<diag2.size();j++)
      |                         ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1104 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 1488 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
3 Halted 0 ms 0 KB -