답안 #1017293

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1017293 2024-07-09T07:14:43 Z overwatch9 커다란 상품 (IOI17_prize) C++17
20 / 100
1 ms 428 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
// int N;
// vector <int> nums;
// vector <int> ask(int i) {
//     vector <int> ans(2, 0);
//     for (int j = 0; j < i; j++) {
//         if (nums[j] > nums[i])
//             ans[0]++;
//     }
//     for (int j = i+1; j < N; j++) {
//         if (nums[j] > nums[i])
//             ans[1]++;
//     }
//     return ans;
// }
int find_best(int n) {
	int lo = 0, hi = n;
    // cout << n << '\n';
    while (lo <= hi) {
        int mid = (lo + hi) / 2;
        auto res = ask(mid);
        // cout << "GUESS: " << mid << '\n';
        // cout << "RESULT: " << res[0] << ' ' << res[1] << '\n';
        if (res[0] + res[1] == 0)
            return mid;
        if (res[0] > res[1])
            hi = mid-1;
        else
            lo = mid+1;
    }
    return lo;
}

// int main() {
//     cin >> N;
//     nums.resize(N+1);
//     for (int i = 0; i < N; i++)
//         cin >> nums[i];
//     find_best(N);
// }
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 424 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 424 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 428 KB Output is correct
8 Correct 0 ms 408 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 424 KB Output is correct
3 Correct 0 ms 424 KB Output is correct
4 Correct 1 ms 428 KB Output is correct
5 Correct 0 ms 424 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 424 KB Output is correct
8 Correct 1 ms 420 KB Output is correct
9 Correct 0 ms 428 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 404 KB answer is not correct
12 Halted 0 ms 0 KB -