답안 #834821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
834821 2023-08-22T20:28:51 Z oscar1f Vision Program (IOI19_vision) C++17
59 / 100
10 ms 1356 KB
#include<bits/stdc++.h>
#include "vision.h"

using namespace std;

int nbLig,nbCol,distObj;
vector<int> listeLig,listeCol,distLig,distCol;

bool estPN(int nb) {
    int div=2,nbFact=0;
    while (nb>1) {
        if (nb%div==0) {
            while (nb%div==0) {
                nb/=div;
            }
            nbFact++;
        }
        div++;
    }
    return (nbFact<=1);
}

vector<int> calcDist(vector<int> val) {
    vector<int> rep,quest,globQuest;
    vector<pair<int,int>> listePN;
    int taille=val.size(),temp;
    rep.push_back(add_xor(val));
    for (int i=1;i<taille;i++) {
        if (estPN(i)) {
            //cout<<i<<" ";
            globQuest.clear();
            for (int j=0;j<i;j++) {
                quest.clear();
                for (int k=j;k<taille;k+=i) {
                    quest.push_back(val[k]);
                }
                if (quest.size()>1) {
                    globQuest.push_back(add_xor({add_or(quest),add_xor(quest)}));
                }
            }
            listePN.push_back({i,add_or(globQuest)});
            temp=add_not(listePN.back().second);
        }
    }
    //cout<<listePN.size()<<endl;
    for (int i=1;i<taille;i++) {
        quest.clear();
        for (auto div:listePN) {
            if (i%div.first==0) {
                quest.push_back(div.second);
            }
            else {
                quest.push_back(div.second+1);
            }
        }
        rep.push_back(add_and(quest));
    }
    return rep;
}

void construct_network(int H, int W, int K) {
	nbLig=H;
	nbCol=W;
	distObj=K;
    vector<int> quest;
	for (int j=0;j<nbCol;j++) {
        quest.clear();
        for (int i=0;i<nbLig;i++) {
            quest.push_back(i*nbCol+j);
        }
        listeCol.push_back(add_or(quest));
    }
    distCol=calcDist(listeCol);
    for (int i=0;i<nbLig;i++) {
        quest.clear();
        for (int j=0;j<nbCol;j++) {
            quest.push_back(i*nbCol+j);
        }
        listeLig.push_back(add_or(quest));
    }
    distLig=calcDist(listeLig);
    quest.clear();
    for (int i=0;i<nbLig;i++) {
        for (int j=0;j<nbCol;j++) {
            if (i+j==distObj) {
                quest.push_back(add_and({distLig[i],distCol[j]}));
            }
        }
    }
    add_or(quest);
}

Compilation message

vision.cpp: In function 'std::vector<int> calcDist(std::vector<int>)':
vision.cpp:26:27: warning: variable 'temp' set but not used [-Wunused-but-set-variable]
   26 |     int taille=val.size(),temp;
      |                           ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 5 ms 976 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 2 ms 596 KB Output is correct
41 Correct 3 ms 724 KB Output is correct
42 Correct 3 ms 724 KB Output is correct
43 Correct 7 ms 976 KB Output is correct
44 Correct 5 ms 976 KB Output is correct
45 Correct 5 ms 976 KB Output is correct
46 Correct 6 ms 976 KB Output is correct
47 Correct 5 ms 976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1104 KB Output is correct
2 Correct 6 ms 1104 KB Output is correct
3 Correct 6 ms 1104 KB Output is correct
4 Correct 6 ms 1056 KB Output is correct
5 Correct 6 ms 1104 KB Output is correct
6 Correct 6 ms 1104 KB Output is correct
7 Correct 6 ms 1104 KB Output is correct
8 Correct 5 ms 1104 KB Output is correct
9 Correct 6 ms 1104 KB Output is correct
10 Correct 6 ms 1140 KB Output is correct
11 Correct 6 ms 1104 KB Output is correct
12 Correct 6 ms 1104 KB Output is correct
13 Correct 6 ms 1104 KB Output is correct
14 Correct 6 ms 1104 KB Output is correct
15 Correct 6 ms 1104 KB Output is correct
16 Correct 6 ms 1104 KB Output is correct
17 Correct 6 ms 1104 KB Output is correct
18 Correct 6 ms 1104 KB Output is correct
19 Correct 10 ms 1104 KB Output is correct
20 Correct 6 ms 1104 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 3 ms 596 KB Output is correct
6 Correct 3 ms 596 KB Output is correct
7 Correct 3 ms 596 KB Output is correct
8 Correct 4 ms 848 KB Output is correct
9 Correct 4 ms 848 KB Output is correct
10 Correct 4 ms 856 KB Output is correct
11 Correct 4 ms 848 KB Output is correct
12 Correct 5 ms 848 KB Output is correct
13 Correct 5 ms 1104 KB Output is correct
14 Correct 6 ms 1104 KB Output is correct
15 Correct 6 ms 1104 KB Output is correct
16 Correct 10 ms 1104 KB Output is correct
17 Correct 6 ms 1104 KB Output is correct
18 Correct 5 ms 1104 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Incorrect 1 ms 1236 KB WA in grader: Too many instructions
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1356 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 2 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 5 ms 976 KB Output is correct
39 Correct 2 ms 468 KB Output is correct
40 Correct 2 ms 596 KB Output is correct
41 Correct 3 ms 724 KB Output is correct
42 Correct 3 ms 724 KB Output is correct
43 Correct 7 ms 976 KB Output is correct
44 Correct 5 ms 976 KB Output is correct
45 Correct 5 ms 976 KB Output is correct
46 Correct 6 ms 976 KB Output is correct
47 Correct 5 ms 976 KB Output is correct
48 Correct 6 ms 1104 KB Output is correct
49 Correct 6 ms 1104 KB Output is correct
50 Correct 6 ms 1104 KB Output is correct
51 Correct 6 ms 1056 KB Output is correct
52 Correct 6 ms 1104 KB Output is correct
53 Correct 6 ms 1104 KB Output is correct
54 Correct 6 ms 1104 KB Output is correct
55 Correct 5 ms 1104 KB Output is correct
56 Correct 6 ms 1104 KB Output is correct
57 Correct 6 ms 1140 KB Output is correct
58 Correct 6 ms 1104 KB Output is correct
59 Correct 6 ms 1104 KB Output is correct
60 Correct 6 ms 1104 KB Output is correct
61 Correct 6 ms 1104 KB Output is correct
62 Correct 6 ms 1104 KB Output is correct
63 Correct 6 ms 1104 KB Output is correct
64 Correct 6 ms 1104 KB Output is correct
65 Correct 6 ms 1104 KB Output is correct
66 Correct 10 ms 1104 KB Output is correct
67 Correct 6 ms 1104 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 3 ms 596 KB Output is correct
73 Correct 3 ms 596 KB Output is correct
74 Correct 3 ms 596 KB Output is correct
75 Correct 3 ms 596 KB Output is correct
76 Correct 3 ms 596 KB Output is correct
77 Correct 4 ms 848 KB Output is correct
78 Correct 4 ms 848 KB Output is correct
79 Correct 4 ms 856 KB Output is correct
80 Correct 4 ms 848 KB Output is correct
81 Correct 5 ms 848 KB Output is correct
82 Correct 5 ms 1104 KB Output is correct
83 Correct 6 ms 1104 KB Output is correct
84 Correct 6 ms 1104 KB Output is correct
85 Correct 10 ms 1104 KB Output is correct
86 Correct 6 ms 1104 KB Output is correct
87 Correct 5 ms 1104 KB Output is correct
88 Correct 6 ms 1104 KB Output is correct
89 Incorrect 1 ms 1236 KB WA in grader: Too many instructions
90 Halted 0 ms 0 KB -