답안 #838200

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
838200 2023-08-26T10:18:38 Z Dremix10 드문 곤충 (IOI22_insects) C++17
0 / 100
1 ms 208 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; 
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:43:18: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
   43 |             bool ok =false;
      |                  ^~
# 결과 실행 시간 메모리 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 Incorrect 0 ms 208 KB Wrong answer.
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 Incorrect 0 ms 208 KB Wrong answer.
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 1 ms 208 KB Output is correct
4 Correct 1 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 -