답안 #153068

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153068 2019-09-12T06:44:12 Z oolimry Vision Program (IOI19_vision) C++14
20 / 100
26 ms 2808 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
void construct_network(int H, int W, int K) {

    map<int, vector<int> > a; ///down left (/)
    map<int, vector<int> > b; ///down right (\)

    for(int r = 0;r < H;r++){
        for(int c = 0;c < W;c++){
            a[r+c].push_back(r * W + c);
            b[r-c].push_back(r * W + c);
        }
    }

    int s = a.size();
    int cnt = H*W;
    for(map<int, vector<int> >::iterator it  = a.begin();it != a.end();it++){
        //cout << it->first << ": ";
        for(int x : it->second){
            //cout << x << " ";
        }
        //cout << "\n";
        add_or(it->second);
        cnt++;
    }

    for(map<int, vector<int> >::iterator it  = b.begin();it != b.end();it++){
        //cout << it->first << ": ";
        for(int x : it->second){
           // cout << x << " ";
        }
        //cout << "\n";
        add_or(it->second);
        cnt++;
    }
    for(int i = 0;i < s;i++){
        add_or({H*W+i,H*W+s+i});
        cnt++;
    }
    for(int i = 0;i < s;i++){
        add_not(H*W+2*s+i);
        cnt++;
    }
    for(int i = 0;i < s;i++){
        vector<int> Ns;
        Ns.push_back(H*W+2*s+i);
        for(int j = 0;j < i;j++){
            Ns.push_back(H*W+3*s+j);
        }
        add_and(Ns);
        cnt++;
    }
    int pnt1 = cnt;
    int k = K;
    for(int i = 0;i < s-k;i++){
        add_and({H*W+4*s+i, H*W+i, H*W+i+k});
        add_and({H*W+4*s+i, H*W+s+i, H*W+i+s+k});
        cnt += 2;
    }
    vector<int> Ns;
    for(int i = pnt1 ;i < cnt;i++){

        Ns.push_back(i);
    }
    add_or(Ns);
    //cout << cnt - pnt1 << "\n";


}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:20:17: warning: unused variable 'x' [-Wunused-variable]
         for(int x : it->second){
                 ^
vision.cpp:30:17: warning: unused variable 'x' [-Wunused-variable]
         for(int x : it->second){
                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Incorrect 2 ms 256 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Incorrect 2 ms 256 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Incorrect 2 ms 256 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Incorrect 2 ms 256 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 636 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 6 ms 632 KB Output is correct
6 Correct 5 ms 632 KB Output is correct
7 Correct 5 ms 632 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 5 ms 632 KB Output is correct
10 Correct 6 ms 632 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
12 Correct 5 ms 632 KB Output is correct
13 Correct 5 ms 632 KB Output is correct
14 Correct 5 ms 632 KB Output is correct
15 Correct 5 ms 632 KB Output is correct
16 Correct 5 ms 632 KB Output is correct
17 Correct 5 ms 632 KB Output is correct
18 Correct 5 ms 632 KB Output is correct
19 Correct 5 ms 632 KB Output is correct
20 Correct 5 ms 632 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 4 ms 504 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
7 Correct 4 ms 504 KB Output is correct
8 Correct 7 ms 760 KB Output is correct
9 Correct 7 ms 808 KB Output is correct
10 Correct 7 ms 760 KB Output is correct
11 Correct 7 ms 760 KB Output is correct
12 Correct 7 ms 760 KB Output is correct
13 Correct 6 ms 632 KB Output is correct
14 Correct 5 ms 632 KB Output is correct
15 Correct 5 ms 632 KB Output is correct
16 Correct 5 ms 632 KB Output is correct
17 Correct 5 ms 632 KB Output is correct
18 Correct 5 ms 632 KB Output is correct
19 Correct 5 ms 632 KB Output is correct
20 Correct 15 ms 1656 KB Output is correct
21 Correct 14 ms 1656 KB Output is correct
22 Correct 15 ms 1528 KB Output is correct
23 Correct 15 ms 1548 KB Output is correct
24 Correct 15 ms 1656 KB Output is correct
25 Correct 15 ms 1528 KB Output is correct
26 Correct 15 ms 1528 KB Output is correct
27 Correct 26 ms 2808 KB Output is correct
28 Correct 26 ms 2780 KB Output is correct
29 Correct 26 ms 2680 KB Output is correct
30 Correct 26 ms 2740 KB Output is correct
31 Correct 26 ms 2552 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 2744 KB on inputs (126, 120), (176, 169), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 380 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Incorrect 2 ms 256 KB on inputs (0, 1), (2, 0), expected 0, but computed 1
14 Halted 0 ms 0 KB -