답안 #362479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
362479 2021-02-03T10:43:25 Z MoldovanAndrei1 Vision Program (IOI19_vision) C++14
0 / 100
9 ms 1132 KB
#include "vision.h"
int w1;
int OP(int a , int b )
{
    return a*w1+b;
}
int line[205],column[205];
void construct_network(int H, int W, int K) {
	std::vector<int> NS;
	w1=W;
	int poz=H*W-1;
	for(int i=0;i<H;i++)
    {
        NS.clear();
        for(int j=0;j<W;j++)
        NS.push_back(OP(i,j));
        line[i]=add_or(NS);
        poz++;
    }
    for(int j = 0 ; j < W ; j++)
    {
        NS.clear();
        for(int i = 0 ; i < H; i++)
            NS.push_back(OP(i,j));
        column[j]=add_or(NS);
        poz++;
    }
    int l1 = -1 , l2 = -1 , c1=  -1 , c2 = -1;
    for(int i = 0 ; i < H; i ++)
    {
        if(line[i])
        {
         if(l1==-1)l1=i;
         else
                l2=i;
        }
    }
    for(int j=0;j<W;j++)
    {
        if(column[j])
        {
            if(c1==-1)c1=j;
            else
                c2=j;
        }
    }
    NS.clear();
    if(l1!=l2 && c1 != c2)
    {
        NS.push_back(OP(l1,c1));
        NS.push_back(OP(l2,c2));
        int a=add_and(NS);
        poz++;
        NS.clear();

        NS.push_back(OP(l1,c2));
        NS.push_back(OP(l2,c1));
        a=add_and(NS);
        poz++;
        NS.clear();
        NS.push_back(poz-2);
        NS.push_back(poz-1);
        int b=add_or(NS);
    }
    if(l1 == l2)
    {
        std::vector<int>r;
        for(int j = 0; j < W - K;j++)
        {
            NS.clear();
            NS.push_back(OP(l1,j));
            NS.push_back(OP(l1,j+K));
            int a=add_and(NS);
            poz++;
            r.push_back(poz);
        }
        int b=add_or(r);
    }
    if(c1 == c2)
    {
        std::vector<int>r;
        for(int i = 0 ;i < H-K;i++)
        {
            NS.clear();
            NS.push_back(OP(i,c1));
            NS.push_back(OP(i+K,c1));
            int a=add_and(NS);
            poz++;
            r.push_back(poz);
        }
        int b=add_or(r);
    }

}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:52:13: warning: variable 'a' set but not used [-Wunused-but-set-variable]
   52 |         int a=add_and(NS);
      |             ^
vision.cpp:63:13: warning: unused variable 'b' [-Wunused-variable]
   63 |         int b=add_or(NS);
      |             ^
vision.cpp:73:17: warning: unused variable 'a' [-Wunused-variable]
   73 |             int a=add_and(NS);
      |                 ^
vision.cpp:77:13: warning: unused variable 'b' [-Wunused-variable]
   77 |         int b=add_or(r);
      |             ^
vision.cpp:87:17: warning: unused variable 'a' [-Wunused-variable]
   87 |             int a=add_and(NS);
      |                 ^
vision.cpp:91:13: warning: unused variable 'b' [-Wunused-variable]
   91 |         int b=add_or(r);
      |             ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 1132 KB on inputs (196, 156), (197, 156), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -