답안 #873593

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
873593 2023-11-15T10:38:33 Z andrei_boaca Vision Program (IOI19_vision) C++17
12 / 100
7 ms 1240 KB
#include "vision.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;

vector<int> lins,cols;
vector<int> dlin[505],dcol[505];
int d1[505],d2[505],ind;
void construct_network(int H, int W, int K)
{
    for(int i=0;i<=200;i++)
        d1[i]=d2[i]=-1;
    if(min(H,W)==1)
    {
        H=max(H,W);
        vector<int> v;
        int cnt=0;
        for(int i=0;i+K<H;i++)
        {
            v={i,i+K};
            add_and(v);
            cnt++;
        }
        v.clear();
        for(int i=H;i<H+cnt;i++)
            v.push_back(i);
        assert(v.size()==cnt);
        add_or(v);
        return;
    }
    ind=H*W-1;
    for(int i=0;i<H;i++)
    {
        vector<int> v;
        for(int j=0;j<W;j++)
            v.push_back({i*W+j});
        add_or(v);
        ind++;
        lins.push_back(ind);
    }
    for(int j=0;j<W;j++)
    {
        vector<int> v;
        for(int i=0;i<H;i++)
            v.push_back({i*W+j});
        add_or(v);
        ind++;
        cols.push_back(ind);
    }
    for(int i=0;i<H;i++)
        for(int j=i+1;j<H&&j-i<=K;j++)
        {
            vector<int> v={lins[i],lins[j]};
            add_and(v);
            ind++;
            dlin[j-i].push_back(ind);
        }
    for(int i=0;i<W;i++)
        for(int j=i+1;j<W&&j-i<=K;j++)
        {
            vector<int> v={cols[i],cols[j]};
            add_and(v);
            ind++;
            dcol[j-i].push_back(ind);
        }
    vector<int> a;
    for(int d=1;d<=H-1&&d<=K;d++)
    {
        ind++;
        add_or(dlin[d]);
        d1[d]=ind;
        a.push_back(ind);
    }
    add_or(a);
    ind++;
    add_not(ind);
    ind++;
    d1[0]=ind;

    a.clear();
    for(int d=1;d<=W-1&&d<=K;d++)
    {
        ind++;
        add_or(dcol[d]);
        d2[d]=ind;
        a.push_back(ind);
    }
    add_or(a);
    ind++;
    add_not(ind);
    ind++;
    d2[0]=ind;
    vector<int> cand;
    for(int x=0;x<=H-1;x++)
        for(int y=0;y<=W-1;y++)
            if(x+y==K)
            {
                vector<int> v={d1[x],d2[y]};
                add_and(v);
                ind++;
                cand.push_back(ind);
            }
    add_or(cand);
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from vision.cpp:2:
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:27:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |         assert(v.size()==cnt);
      |                ~~~~~~~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 432 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 600 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 392 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 3 ms 860 KB Output is correct
6 Correct 4 ms 984 KB Output is correct
7 Correct 3 ms 984 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 4 ms 984 KB Output is correct
10 Correct 6 ms 1240 KB Output is correct
11 Incorrect 1 ms 1236 KB WA in grader: Too many instructions
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1116 KB on inputs (57, 107), (59, 108), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -