답안 #743746

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
743746 2023-05-17T22:00:05 Z iulia13 커다란 상품 (IOI17_prize) C++14
0 / 100
1 ms 328 KB
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
const int N = 2e5 + 5;
int a[N];
int b[N];
int s[N];
int ans;
vector <int> v;
/*vector<int> ask(int i) {

    cout << i << '\n';
	vector<int> res(2);
	cin >> res[0] >> res[1];
	return res;
}
*/
void divide(int st, int dr)
{
    int mid = (st + dr) / 2;
    if (s[mid])
        return;
    v = ask(mid);
    a[mid] = v[0];
    b[mid] = v[1];
    s[mid] = a[mid] + b[mid];
    if (s[mid] == 0)
    {
        ans = mid;
        return;
    }
    if (ans)
        return;
    if (!(s[st] == s[mid] && a[mid] == a[st]))
        divide(st, mid);
    if (ans)
        return;
    if (!(s[dr] == s[mid] && a[mid] == a[dr]))
        divide(mid, dr);
    return;
}
int find_best(int n)
{
    vector <int> v;

    v = ask(0);
    a[0] = v[0];
    b[0] = v[1];
    s[0] = a[0] + b[0];
    v = ask(n - 1);
    a[n - 1] = v[0];
    b[n - 1] = v[1];
    s[n - 1] = a[n - 1] + b[n - 1];
    if (s[0] == 0)
        ans = 0;
    if (s[n - 1] == 0)
        ans = n - 1;
    divide(0, n - 1);
    cout << ans;
    return ans;
}/*
int main()
{
    find_best(8);
    return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 288 KB Token "30139B" doesn't correspond to pattern "[A-B]{1}"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 328 KB Token "30139B" doesn't correspond to pattern "[A-B]{1}"
2 Halted 0 ms 0 KB -