Submission #627560

# Submission time Handle Problem Language Result Execution time Memory
627560 2022-08-12T16:55:32 Z Black_Ghost Rarest Insects (IOI22_insects) C++17
0 / 100
1 ms 208 KB
#include "insects.h"
#include <vector>
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
int min_cardinality(int N) {
    int n=N;
    int gr[3000]={};
    int idx[3000]={};
    int cr=1;
    std::vector<int> v;
    for(int i=0;i<n;i++){
      move_inside(i);
      int g=press_button();
      if(g==1){
          idx[i]=cr;
          gr[cr]++;
          v.pb(i);
          cr++;
          continue;
      }
      else{
        for(int j=0;j<v.size();j++){
            move_outside(v[j]);
            int res=press_button();
            if(res==1){
                idx[i]=idx[v[j]];
                gr[idx[i]]++;
                v.erase(v.begin()+j);
                v.pb(i);
                break;

            }
        }
        move_outside(i);
      }
    }
    int mn=n;
    for(int i=1;i<cr;i++){
      mn=min(mn,gr[i]);
    }

  return mn;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:25:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for(int j=0;j<v.size();j++){
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Incorrect 1 ms 208 KB Wrong answer.
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Incorrect 1 ms 208 KB Wrong answer.
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Incorrect 1 ms 208 KB Wrong answer.
7 Halted 0 ms 0 KB -