Submission #860261

# Submission time Handle Problem Language Result Execution time Memory
860261 2023-10-12T11:41:13 Z vjudge1 Rarest Insects (IOI22_insects) C++17
60.03 / 100
112 ms 1716 KB
#include<bits/stdc++.h>
#include"insects.h"
using namespace std;
int min_cardinality(int N){
    vector<int> u;
    map<int, int> tipo;
    vector<int> v;
    for(int i=0; i<N; i++){
        move_inside(i);
        if(press_button()==1){
            u.push_back(i);
            tipo[i]=u.size()-1;
        }else{
            move_outside(i);
            v.push_back(i);
        }
    }
    for(int i: u) move_outside(i);
    int pot=1;
    int U = u.size();
    set<int> S;
    while(pot<=U){
        for(int i: u){
            if((tipo[i]&pot)!=0){
                if(S.find(i)==S.end())move_inside(i);
                S.insert(i);
            }else{
                if(S.find(i)!=S.end())move_outside(i);
                S.erase(i);
            }
        }
        for(int i:v){
            move_inside(i);
            if(press_button()!=1){
                tipo[i]+=pot;
            }
            move_outside(i);
        }
        pot*=2;
    }
    map<int, int> m;
    for(int i=0; i<N; i++) m[tipo[i]]++;
    int minimo = N;
    for(auto l: m){
        minimo=min(minimo, l.second);
    }
    return minimo;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 3 ms 856 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 692 KB Output is correct
9 Correct 5 ms 856 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 4 ms 600 KB Output is correct
12 Correct 4 ms 944 KB Output is correct
13 Correct 4 ms 600 KB Output is correct
14 Correct 4 ms 600 KB Output is correct
15 Correct 5 ms 860 KB Output is correct
16 Correct 4 ms 856 KB Output is correct
17 Correct 4 ms 600 KB Output is correct
18 Correct 4 ms 856 KB Output is correct
19 Correct 6 ms 856 KB Output is correct
20 Correct 5 ms 448 KB Output is correct
21 Correct 4 ms 692 KB Output is correct
22 Correct 4 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 3 ms 856 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 692 KB Output is correct
9 Correct 5 ms 856 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 4 ms 600 KB Output is correct
12 Correct 4 ms 944 KB Output is correct
13 Correct 4 ms 600 KB Output is correct
14 Correct 4 ms 600 KB Output is correct
15 Correct 5 ms 860 KB Output is correct
16 Correct 4 ms 856 KB Output is correct
17 Correct 4 ms 600 KB Output is correct
18 Correct 4 ms 856 KB Output is correct
19 Correct 6 ms 856 KB Output is correct
20 Correct 5 ms 448 KB Output is correct
21 Correct 4 ms 692 KB Output is correct
22 Correct 4 ms 600 KB Output is correct
23 Correct 11 ms 596 KB Output is correct
24 Correct 8 ms 728 KB Output is correct
25 Correct 33 ms 864 KB Output is correct
26 Correct 30 ms 948 KB Output is correct
27 Correct 15 ms 672 KB Output is correct
28 Correct 36 ms 596 KB Output is correct
29 Correct 23 ms 960 KB Output is correct
30 Correct 39 ms 1456 KB Output is correct
31 Correct 21 ms 1188 KB Output is correct
32 Correct 23 ms 960 KB Output is correct
33 Correct 29 ms 1372 KB Output is correct
34 Correct 31 ms 856 KB Output is correct
35 Correct 35 ms 1184 KB Output is correct
36 Correct 38 ms 1128 KB Output is correct
37 Correct 34 ms 1212 KB Output is correct
38 Correct 44 ms 1384 KB Output is correct
39 Correct 53 ms 964 KB Output is correct
40 Correct 37 ms 1364 KB Output is correct
41 Correct 29 ms 1120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 21 ms 444 KB Output is correct
8 Partially correct 16 ms 1160 KB Output is partially correct
9 Partially correct 72 ms 764 KB Output is partially correct
10 Partially correct 80 ms 1112 KB Output is partially correct
11 Correct 36 ms 604 KB Output is correct
12 Partially correct 75 ms 1212 KB Output is partially correct
13 Partially correct 48 ms 736 KB Output is partially correct
14 Partially correct 81 ms 1016 KB Output is partially correct
15 Partially correct 54 ms 1192 KB Output is partially correct
16 Partially correct 68 ms 1460 KB Output is partially correct
17 Partially correct 71 ms 1204 KB Output is partially correct
18 Partially correct 56 ms 1496 KB Output is partially correct
19 Partially correct 65 ms 1632 KB Output is partially correct
20 Partially correct 83 ms 1488 KB Output is partially correct
21 Partially correct 97 ms 1228 KB Output is partially correct
22 Partially correct 81 ms 764 KB Output is partially correct
23 Partially correct 102 ms 1480 KB Output is partially correct
24 Partially correct 94 ms 1160 KB Output is partially correct
25 Partially correct 84 ms 1624 KB Output is partially correct
26 Partially correct 54 ms 1300 KB Output is partially correct
27 Partially correct 83 ms 1392 KB Output is partially correct
28 Partially correct 76 ms 1452 KB Output is partially correct
29 Partially correct 81 ms 1188 KB Output is partially correct
30 Partially correct 62 ms 764 KB Output is partially correct
31 Partially correct 90 ms 1716 KB Output is partially correct
32 Partially correct 86 ms 1204 KB Output is partially correct
33 Partially correct 95 ms 1256 KB Output is partially correct
34 Partially correct 79 ms 1252 KB Output is partially correct
35 Partially correct 87 ms 996 KB Output is partially correct
36 Partially correct 85 ms 1220 KB Output is partially correct
37 Partially correct 91 ms 1452 KB Output is partially correct
38 Partially correct 82 ms 1640 KB Output is partially correct
39 Partially correct 103 ms 1204 KB Output is partially correct
40 Partially correct 112 ms 1632 KB Output is partially correct
41 Partially correct 82 ms 1128 KB Output is partially correct
42 Partially correct 76 ms 1204 KB Output is partially correct
43 Partially correct 12 ms 1112 KB Output is partially correct
44 Partially correct 46 ms 944 KB Output is partially correct
45 Correct 40 ms 1456 KB Output is correct
46 Partially correct 76 ms 1112 KB Output is partially correct
47 Partially correct 75 ms 1368 KB Output is partially correct
48 Partially correct 66 ms 1144 KB Output is partially correct