Submission #627563

# Submission time Handle Problem Language Result Execution time Memory
627563 2022-08-12T16:57:24 Z Black_Ghost Rarest Insects (IOI22_insects) C++17
10 / 100
399 ms 324 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_inside(v[j]);
        }
        
      }
    }
    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 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 2 ms 324 KB Output is correct
8 Correct 11 ms 208 KB Output is correct
9 Correct 11 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 49 ms 208 KB Output is correct
12 Correct 7 ms 208 KB Output is correct
13 Correct 12 ms 208 KB Output is correct
14 Correct 6 ms 208 KB Output is correct
15 Correct 8 ms 208 KB Output is correct
16 Correct 8 ms 208 KB Output is correct
17 Correct 5 ms 208 KB Output is correct
18 Correct 11 ms 208 KB Output is correct
19 Correct 19 ms 208 KB Output is correct
20 Correct 29 ms 208 KB Output is correct
21 Correct 20 ms 208 KB Output is correct
22 Correct 31 ms 300 KB Output is correct
# 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 Correct 4 ms 208 KB Output is correct
7 Correct 2 ms 324 KB Output is correct
8 Correct 11 ms 208 KB Output is correct
9 Correct 11 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 49 ms 208 KB Output is correct
12 Correct 7 ms 208 KB Output is correct
13 Correct 12 ms 208 KB Output is correct
14 Correct 6 ms 208 KB Output is correct
15 Correct 8 ms 208 KB Output is correct
16 Correct 8 ms 208 KB Output is correct
17 Correct 5 ms 208 KB Output is correct
18 Correct 11 ms 208 KB Output is correct
19 Correct 19 ms 208 KB Output is correct
20 Correct 29 ms 208 KB Output is correct
21 Correct 20 ms 208 KB Output is correct
22 Correct 31 ms 300 KB Output is correct
23 Correct 17 ms 208 KB Output is correct
24 Correct 18 ms 208 KB Output is correct
25 Correct 175 ms 248 KB Output is correct
26 Correct 163 ms 208 KB Output is correct
27 Correct 21 ms 208 KB Output is correct
28 Incorrect 393 ms 300 KB Too many queries.
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 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 Correct 1 ms 208 KB Output is correct
7 Correct 32 ms 208 KB Output is correct
8 Correct 20 ms 208 KB Output is correct
9 Incorrect 399 ms 208 KB Too many queries.
10 Halted 0 ms 0 KB -