답안 #291782

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
291782 2020-09-05T19:01:35 Z medmdg Vision Program (IOI19_vision) C++14
66 / 100
442 ms 2204 KB
#include<bits/stdc++.h>
#include "vision.h"
using namespace std;
vector<int> DT(int H,int W,int i,int K){
    vector<int> ans;
    for(int j=0;j<H*W;j++){
        if(abs(j%W-i%W)+abs(j/W-i/W)==K){
            ans.push_back(j);
        }
    }
    return ans;
}
void construct_network(int H, int W, int K){
    vector<int> b;
    b.push_back(0);
    b.push_back(1);
    if(H*W>2)
        b.push_back(2);
    int l=add_and(b);
    b.pop_back();
    b.pop_back();
    if(b.size())
        b.pop_back();
    b.push_back(l);
    if(H*W==2){
        if(K==1)
            return;
        else
            l=add_not(0);
        return;
    }
    if(min(H,W)==1){
        for(int i=0;i<H*W-K;i++){
            vector<int> ans;
            ans.push_back(i);
            ans.push_back(i+K);
            l=add_and(ans);
            ans.pop_back();
            ans.pop_back();
            ans.push_back(l-1);
            ans.push_back(l);
            l=add_or(ans);
        }
        return;
    }
    if(K==1){
        int be,en;
        be=l+1;
        for(int i=0;i<H;i++){
            vector<int> ans;
            for(int j=0;j<W;j++){
                ans.push_back(j+i*W);
            }
            en=add_or(ans);
        }
        int b,e;
        b=en+1;
        for(int i=0;i<W;i++){
            vector<int> ans;
            for(int j=i;j<W*H;j+=W){
                ans.push_back(j);
            }
            e=add_or(ans);
        }
        int poss0H;
        vector<int> rea;
        for(int i=be;i<=en;i++){
            rea.push_back(i);
        }
        poss0H=add_xor(rea);
        int poss1H;
        vector<int> jgf;
        for(int i=be;i<en;i++){
             vector<int> re;
            re.push_back(i);
            re.push_back(i+1);
            jgf.push_back(add_and(re));
        }
        poss1H=add_or(jgf);
        int poss0W;
        vector<int> ria;
        for(int i=b;i<=e;i++){
            ria.push_back(i);
        }
        poss0W=add_xor(ria);
        int poss1W;
        vector<int> jf;
        for(int i=b;i<e;i++){
             vector<int> re;
            re.push_back(i);
            re.push_back(i+1);
            jf.push_back(add_and(re));
        }
        poss1W=add_or(jf);
        vector<int> nb;
        nb.push_back(poss0W);
        nb.push_back(poss1H);
        e=add_and(nb);
        nb[0]=poss1W;
        nb[1]=poss0H;
        b=add_and(nb);
        nb[0]=e;
        nb[1]=b;
        en=add_or(nb);
        return;
    }
    if(max(H,W)<=100){
        for(int i=0;i<H*W-K;i++){
            vector<int> ans;
            int h=(int)(DT(H,W,i,K).size()!=0);
            if(h){
            l=add_or(DT(H,W,i,K));
            ans.push_back(l);
            ans.push_back(i);
            l=add_and(ans);
            ans.pop_back();
            ans.pop_back();
            ans.push_back(l);
            ans.push_back(l-2);
            l=add_or(ans);
            }
        }
        return;
    }
    else{
        vector<int> ans;
        for(int i=1;i<H*W;i++){
            if((i%W)+(i/W)==K){
                ans.push_back(i);
            }
        }
        l=add_or(ans);
        return;
    }
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:88:22: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
   88 |         for(int i=b;i<e;i++){
      |                     ~^~
vision.cpp:73:23: warning: 'en' may be used uninitialized in this function [-Wmaybe-uninitialized]
   73 |         for(int i=be;i<en;i++){
      |                      ~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Correct 17 ms 768 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 4 ms 512 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 16 ms 768 KB Output is correct
35 Correct 14 ms 640 KB Output is correct
36 Correct 9 ms 512 KB Output is correct
37 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Correct 17 ms 768 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 4 ms 512 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 16 ms 768 KB Output is correct
35 Correct 14 ms 640 KB Output is correct
36 Correct 9 ms 512 KB Output is correct
37 Correct 5 ms 256 KB Output is correct
38 Incorrect 442 ms 2204 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 0 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 2 ms 512 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 6 ms 768 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 6 ms 768 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 1 ms 256 KB Output is correct
27 Correct 11 ms 1152 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 1 ms 256 KB Output is correct
31 Correct 1 ms 256 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1152 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 6 ms 768 KB Output is correct
8 Correct 6 ms 768 KB Output is correct
9 Correct 11 ms 1152 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 1 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Correct 17 ms 768 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 2 ms 256 KB Output is correct
32 Correct 4 ms 512 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 16 ms 768 KB Output is correct
35 Correct 14 ms 640 KB Output is correct
36 Correct 9 ms 512 KB Output is correct
37 Correct 5 ms 256 KB Output is correct
38 Incorrect 442 ms 2204 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -