Submission #838202

# Submission time Handle Problem Language Result Execution time Memory
838202 2023-08-26T10:26:33 Z Dremix10 Rarest Insects (IOI22_insects) C++17
10 / 100
313 ms 448 KB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
const int N = 3e5+5;
const int MOD = 1e9+7;
const ll INF = 1e18+5;
#ifdef dremix
    #define p(x) cerr<<#x<<" = "<<x<<endl;
    #define pv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v<<", ";cerr<<"}"<<endl;
    #define p2(x,y) cerr<<#x<<","<<#y<<" = "<<x<<" ,"<<y<<endl;
#else
    #define p(x) {}
    #define pv(x) {}
    #define p2(x,y) {}
#endif



int min_cardinality(int N) {

    int i;
    multiset<int> s;
    int curr = 1;
    s.insert(0);
    move_inside(0);
    bool in[N];
    p2(1,0)
    int arr[N];
    arr[0] = 0;
    int j;
    in[0] = true;

    for(i=1;i<N;i++){
        move_inside(i);
        p2(1,i)
        in[i] = true;
        int x = press_button();
        if(x == 1){
            s.insert(curr);
            arr[i] = curr;
            curr++;
        }
        else{
            //assert(x == 2);
            bool ok =false;
            p(i)
            for(j=i-1;j>=0;j--){
                if(!in[j])continue;
                move_outside(j);
                in[j] = false;
                p2(2,j)
                x = press_button();
                if(x == 1){
                    arr[i] = arr[j];
                    s.insert(arr[i]);
                    ok = true;
                    break;
                }
                p2(1,j)
                move_inside(j);
                in[j] = true;
            }
            assert(ok);
        }
    }
    int ret = N;
    for(auto x : s){
        ret = min(ret,(int)s.count(x));
    }
    return ret; 
}
# 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 3 ms 208 KB Output is correct
7 Correct 2 ms 208 KB Output is correct
8 Correct 11 ms 208 KB Output is correct
9 Correct 10 ms 208 KB Output is correct
10 Correct 3 ms 208 KB Output is correct
11 Correct 4 ms 304 KB Output is correct
12 Correct 6 ms 208 KB Output is correct
13 Correct 14 ms 208 KB Output is correct
14 Correct 6 ms 336 KB Output is correct
15 Correct 7 ms 296 KB Output is correct
16 Correct 7 ms 208 KB Output is correct
17 Correct 11 ms 300 KB Output is correct
18 Correct 7 ms 296 KB Output is correct
19 Correct 18 ms 208 KB Output is correct
20 Correct 24 ms 208 KB Output is correct
21 Correct 29 ms 280 KB Output is correct
22 Correct 27 ms 208 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 3 ms 208 KB Output is correct
7 Correct 2 ms 208 KB Output is correct
8 Correct 11 ms 208 KB Output is correct
9 Correct 10 ms 208 KB Output is correct
10 Correct 3 ms 208 KB Output is correct
11 Correct 4 ms 304 KB Output is correct
12 Correct 6 ms 208 KB Output is correct
13 Correct 14 ms 208 KB Output is correct
14 Correct 6 ms 336 KB Output is correct
15 Correct 7 ms 296 KB Output is correct
16 Correct 7 ms 208 KB Output is correct
17 Correct 11 ms 300 KB Output is correct
18 Correct 7 ms 296 KB Output is correct
19 Correct 18 ms 208 KB Output is correct
20 Correct 24 ms 208 KB Output is correct
21 Correct 29 ms 280 KB Output is correct
22 Correct 27 ms 208 KB Output is correct
23 Correct 12 ms 320 KB Output is correct
24 Correct 8 ms 328 KB Output is correct
25 Correct 98 ms 308 KB Output is correct
26 Correct 113 ms 312 KB Output is correct
27 Correct 11 ms 336 KB Output is correct
28 Correct 20 ms 324 KB Output is correct
29 Correct 13 ms 324 KB Output is correct
30 Correct 69 ms 308 KB Output is correct
31 Correct 27 ms 324 KB Output is correct
32 Correct 45 ms 324 KB Output is correct
33 Correct 52 ms 324 KB Output is correct
34 Correct 47 ms 292 KB Output is correct
35 Correct 68 ms 308 KB Output is correct
36 Correct 81 ms 412 KB Output is correct
37 Correct 104 ms 448 KB Output is correct
38 Incorrect 286 ms 444 KB Too many queries.
39 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 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 0 ms 208 KB Output is correct
7 Correct 44 ms 336 KB Output is correct
8 Correct 18 ms 336 KB Output is correct
9 Incorrect 313 ms 308 KB Too many queries.
10 Halted 0 ms 0 KB -