답안 #838196

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
838196 2023-08-26T10:15:47 Z Dremix10 드문 곤충 (IOI22_insects) C++17
0 / 100
1 ms 464 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;
#else
    #define p(x) {}
    #define pv(x) {}
#endif


int min_cardinality(int N) {

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

    for(i=1;i<N;i++){
        move_inside(i);
        int x = press_button();
        if(x == 1){
            s.insert(curr);
            arr[i] = curr;
            curr++;
        }
        else{
            assert(x == 2);
            bool ok =false;
            for(j=i-1;j>=0;j--){
                move_outside(j);
                x = press_button();
                if(x == 1){
                    arr[i] = arr[j];
                    s.insert(arr[i]);
                    ok = true;
                    break;
                }
                move_inside(j);
            }
            assert(ok);
        }
    }
    int ret = N;
    for(auto x : s){
        ret = min(ret,(int)s.count(x));
    }
    return ret; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Runtime error 1 ms 464 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Runtime error 1 ms 464 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 208 KB Output is correct
6 Runtime error 1 ms 464 KB Execution killed with signal 6
7 Halted 0 ms 0 KB -