답안 #830535

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
830535 2023-08-19T07:48:58 Z tolbi 드문 곤충 (IOI22_insects) C++17
0 / 100
0 ms 208 KB
#include <bits/stdc++.h>
using namespace std;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "insects.h"
int min_cardinality(int n) {
    function<int(int)> f;
    f = [&](int x)->int{
        int ans = 0;
        vector<int> crr;
        for (int i = 0; i < n; i++){
            crr.push_back(i);
            move_inside(i);
            if (press_button()>x){
                ans++;
                crr.pop_back();
                move_outside(i);
            }
        }
        for (int i = 0; i < crr.size(); ++i)
        {
            move_outside(i);
        }
        return ans;
    };
    int diff = n-f(1);
    int l = 1, r = n-1;
    while (l<r){
        int mid = l+(r-l+1)/2;
        if (f(mid)>n-mid*diff){
            r=mid-1;
        }
        else l = mid;
    }
    return l;
}

Compilation message

insects.cpp: In lambda function:
insects.cpp:19:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for (int i = 0; i < crr.size(); ++i)
      |                         ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Wrong answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 208 KB Wrong answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 0 ms 208 KB Wrong answer.
3 Halted 0 ms 0 KB -