Submission #1070712

# Submission time Handle Problem Language Result Execution time Memory
1070712 2024-08-22T17:08:13 Z Mihailo Rarest Insects (IOI22_insects) C++17
0 / 100
2000 ms 1368 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]]++;
    for(int i=0; i<N; i++) if(tip[i]>=rep.size()) while(true);
    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:53:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     for(int i=0; i<N; i++) if(tip[i]>=rep.size()) while(true);
      |                               ~~~~~~^~~~~~~~~~~~
insects.cpp:55:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for(int i=0; i<rep.size(); i++) rez=min(rez, (ll)bp[i]);
      |                  ~^~~~~~~~~~~
# 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 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 10 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Execution timed out 3081 ms 600 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 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 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 10 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Execution timed out 3081 ms 600 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Partially correct 0 ms 344 KB Output is partially correct
3 Correct 0 ms 440 KB Output is correct
4 Partially correct 1 ms 356 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 161 ms 420 KB Output is partially correct
8 Partially correct 16 ms 1368 KB Output is partially correct
9 Execution timed out 3080 ms 440 KB Time limit exceeded
10 Halted 0 ms 0 KB -