Submission #1070710

# Submission time Handle Problem Language Result Execution time Memory
1070710 2024-08-22T17:05:26 Z Mihailo Rarest Insects (IOI22_insects) C++17
0 / 100
165 ms 592 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pll pair<long long, long long>
#define MOD 1000002022ll
#define xx first
#define yy second
using namespace std;
typedef long long ll;

void move_inside(int i);
void move_outside(int i);
int press_button();

vector<int> rep;
set<int> setrep;
int tip[10000], bp[10000];

int min_cardinality(int N) {
    for(int i=0; i<N; i++) {
        move_inside(i);
        if(press_button()>1) move_outside(i);
        else {
            rep.pb(i);
            setrep.insert(i);
        }
    }
    for(int i=0; i<rep.size(); i++) tip[rep[i]]=i;
    for(int i=0; i<rep.size(); i++) {
        if(i%2==0) move_outside(rep[i]);
    }
    for(int i=0; i<N; i++) {
        if(!setrep.count(i)) {
            move_inside(i);
            if(press_button()==2) tip[i]+=1;
            move_outside(i);
        }
    }
    for(int b=1; b<=10; b++) {
        for(int i=0; i<rep.size(); i++) {
            if(i&(1<<(b-1))&&!(i&(1<<(b)))) move_outside(i);
            if(!(i&(1<<(b-1)))&&i&(1<<(b))) move_inside(i);
        }
        for(int i=0; i<N; i++) {
            if(!setrep.count(i)) {
                move_inside(i);
                if(press_button()==2) tip[i]+=(1<<b);
                move_outside(i);
            }
        }
    }
    for(int i=0; i<N; i++) bp[tip[i]]++;
    ll rez=MOD;
    for(int i=0; i<rep.size(); i++) rez=min(rez, (ll)bp[i]);
    return rez;
}














Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:28:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=0; i<rep.size(); i++) tip[rep[i]]=i;
      |                  ~^~~~~~~~~~~
insects.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=0; i<rep.size(); i++) {
      |                  ~^~~~~~~~~~~
insects.cpp:40:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for(int i=0; i<rep.size(); i++) {
      |                      ~^~~~~~~~~~~
insects.cpp:54:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     for(int i=0; i<rep.size(); i++) rez=min(rez, (ll)bp[i]);
      |                  ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 12 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Incorrect 12 ms 344 KB Wrong answer.
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 12 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Incorrect 12 ms 344 KB Wrong answer.
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Partially correct 1 ms 344 KB Output is partially correct
3 Correct 0 ms 344 KB Output is correct
4 Partially correct 0 ms 344 KB Output is partially correct
5 Partially correct 0 ms 344 KB Output is partially correct
6 Partially correct 1 ms 344 KB Output is partially correct
7 Partially correct 151 ms 416 KB Output is partially correct
8 Partially correct 9 ms 592 KB Output is partially correct
9 Incorrect 165 ms 440 KB Wrong answer.
10 Halted 0 ms 0 KB -