# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1054754 | 2024-08-12T11:57:14 Z | Ignut | 드문 곤충 (IOI22_insects) | C++17 | 103 ms | 676 KB |
/* Ignut started: 11.08.2024 now: 12.08.2024 ████████████████████████████████████████████████████████████████████ ████████████████████████████████ ████████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████ ██████████████████ ██████████████████ ██████ ██████ ██████████████ ██████████████ ██████ ██████ ██ ████████████ ████████████ ██ ██████ ██████ ████ ██████████ ██████████ ████ ██████ ██████ ████ ██████████ ██████████ ████ ██████ ██████ ████ ██████████ ██████████ ██████ ██████ ██████ ██████ ██████████ ██████████ ██████ ██████ ██████ ██████ ████████ ████████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ██████ ████ ████ ████ ████ ██████ ██████ ██████████ ████ ██████████ ██████ ██████ ██ ██████ ████████ ██████ ██ ██████ ██████ ██████ ████████ ██████ ██████ ██████ ██ ██ ██████ ██████████████████████ ████ ████ ██████████████████████ ████████████████████████ ██ ██ ████████████████████████ ██████████████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ████████████████████████████████████████████████████████████████████ */ #include <bits/stdc++.h> using namespace std; using ll = long long; void move_inside(int i); void move_outside(int i); int press_button(); int n; vector<int> diff; vector<int> in; int prev_mid = 1; int Go(int maxCount) { if (prev_mid < maxCount) { while (!in.empty()) move_outside(in.back()), in.pop_back(); } prev_mid = maxCount; for (int i = 0; i < n; i ++) { move_inside(i); in.push_back(i); if (press_button() > maxCount) { move_outside(i); in.pop_back(); } } int res = in.size(); if (maxCount == 1) diff = in; return res; } int min_cardinality(int N) { n = N; int cntDiff = Go(1); if (cntDiff <= 0) { int minRes = N, sum = 0; for (int i = 0; i < cntDiff - 1; i ++) { vector<int> in; in.push_back(diff[i]); move_inside(diff[i]); for (int j = diff[i] + 1; j < N; j ++) { move_inside(j); in.push_back(j); // cout << "try " << j << ' '; if (press_button() != in.size()) { in.pop_back(); move_outside(j); // cout << "! "; } } // cout << '\n'; minRes = min(minRes, int(in.size())); sum += in.size(); // cout << "have : " << in.size() << '\n'; // for (int val : in) cout << val << ' '; // cout << '\n'; while (!in.empty()) { move_outside(in.back()); in.pop_back(); } } minRes = min(minRes, N - sum); return minRes; } int lo = 1, hi = N / cntDiff; while (lo < hi) { int mid = lo + (hi - lo + 1) / 2; if (1ll * Go(mid) == 1ll * mid * cntDiff) lo = mid; else hi = mid - 1; } return lo; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 432 KB | Output is correct |
9 | Incorrect | 3 ms | 600 KB | Wrong answer. |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 344 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 432 KB | Output is correct |
9 | Incorrect | 3 ms | 600 KB | Wrong answer. |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Partially correct | 0 ms | 344 KB | Output is partially correct |
7 | Partially correct | 103 ms | 672 KB | Output is partially correct |
8 | Correct | 12 ms | 432 KB | Output is correct |
9 | Partially correct | 72 ms | 676 KB | Output is partially correct |
10 | Partially correct | 51 ms | 668 KB | Output is partially correct |
11 | Partially correct | 98 ms | 428 KB | Output is partially correct |
12 | Correct | 20 ms | 344 KB | Output is correct |
13 | Incorrect | 93 ms | 420 KB | Wrong answer. |
14 | Halted | 0 ms | 0 KB | - |