답안 #1082340

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1082340 2024-08-31T07:51:10 Z MMihalev 커다란 상품 (IOI17_prize) C++14
20 / 100
70 ms 2624 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include "prize.h"
using namespace std;
const int MAX_N=2e5+4;
int asked[MAX_N][2];
bool used[MAX_N];
int qq;
pair<int,int>query(int pos)
{
    if(used[pos])return {asked[pos][0],asked[pos][1]};

    if(qq>10000)while(1);
    used[pos]=1;
    qq++;
    auto ve=ask(pos);
    asked[pos][0]=ve[0];
    asked[pos][1]=ve[1];
    return {ve[0],ve[1]};
}
int find_best(int n)
{
    int prevpos=-1;
    int qq=400;
    int big=-1e9;
    while(qq--)
    {
        prevpos++;
        auto cur=query(prevpos);
        int all=cur.first+cur.second;
        if(all==0)return prevpos;
        big=max(big,all);
    }
    while(1)
    {
        prevpos++;
        auto cur=query(prevpos);
        int all=cur.first+cur.second;
        if(all==big)
        {
            int l=prevpos,r=n-1;
            while(l<=r)
            {
                int mid=(l+r)/2;
                auto cur2=query(mid);
                if(cur2==cur)
                {
                    prevpos=mid;
                    l=mid+1;
                }
                else r=mid-1;
            }
        }
        else
        {
            if(all==0)return prevpos;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 444 KB Output is correct
8 Correct 2 ms 600 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 3 ms 856 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 6 ms 1524 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 8 ms 1112 KB Output is correct
16 Partially correct 43 ms 2000 KB Partially correct - number of queries: 7128
17 Correct 4 ms 344 KB Output is correct
18 Partially correct 50 ms 2172 KB Partially correct - number of queries: 8289
19 Correct 2 ms 344 KB Output is correct
20 Correct 11 ms 856 KB Output is correct
21 Correct 17 ms 1624 KB Output is correct
22 Correct 5 ms 856 KB Output is correct
23 Correct 2 ms 344 KB Output is correct
24 Correct 2 ms 344 KB Output is correct
25 Correct 25 ms 1872 KB Output is correct
26 Correct 15 ms 1616 KB Output is correct
27 Correct 2 ms 600 KB Output is correct
28 Partially correct 33 ms 2288 KB Partially correct - number of queries: 7796
29 Partially correct 38 ms 2020 KB Partially correct - number of queries: 6036
30 Partially correct 37 ms 2216 KB Partially correct - number of queries: 8216
31 Correct 2 ms 344 KB Output is correct
32 Correct 5 ms 1112 KB Output is correct
33 Correct 0 ms 596 KB Output is correct
34 Correct 19 ms 1660 KB Output is correct
35 Correct 3 ms 600 KB Output is correct
36 Correct 12 ms 1532 KB Output is correct
37 Correct 2 ms 596 KB Output is correct
38 Correct 2 ms 344 KB Output is correct
39 Correct 20 ms 1632 KB Output is correct
40 Partially correct 40 ms 2320 KB Partially correct - number of queries: 7085
41 Partially correct 27 ms 1948 KB Partially correct - number of queries: 5148
42 Partially correct 27 ms 1872 KB Partially correct - number of queries: 5148
43 Correct 18 ms 1868 KB Output is correct
44 Correct 17 ms 1880 KB Output is correct
45 Correct 15 ms 1348 KB Output is correct
46 Correct 2 ms 344 KB Output is correct
47 Correct 17 ms 1616 KB Output is correct
48 Partially correct 39 ms 1848 KB Partially correct - number of queries: 6245
49 Correct 4 ms 856 KB Output is correct
50 Partially correct 40 ms 2332 KB Partially correct - number of queries: 8289
51 Correct 15 ms 1628 KB Output is correct
52 Correct 4 ms 344 KB Output is correct
53 Correct 3 ms 600 KB Output is correct
54 Correct 25 ms 1840 KB Output is correct
55 Correct 2 ms 340 KB Output is correct
56 Partially correct 45 ms 2128 KB Partially correct - number of queries: 8284
57 Partially correct 19 ms 2072 KB Partially correct - number of queries: 6149
58 Partially correct 34 ms 1872 KB Partially correct - number of queries: 6230
59 Partially correct 32 ms 1732 KB Partially correct - number of queries: 5145
60 Correct 22 ms 1624 KB Output is correct
61 Correct 3 ms 600 KB Output is correct
62 Correct 2 ms 452 KB Output is correct
63 Correct 5 ms 600 KB Output is correct
64 Correct 3 ms 452 KB Output is correct
65 Correct 2 ms 344 KB Output is correct
66 Correct 4 ms 452 KB Output is correct
67 Correct 2 ms 344 KB Output is correct
68 Correct 2 ms 344 KB Output is correct
69 Correct 4 ms 600 KB Output is correct
70 Correct 3 ms 344 KB Output is correct
71 Partially correct 37 ms 2148 KB Partially correct - number of queries: 8176
72 Correct 4 ms 1364 KB Output is correct
73 Partially correct 41 ms 2148 KB Partially correct - number of queries: 8051
74 Partially correct 45 ms 2164 KB Partially correct - number of queries: 8125
75 Correct 4 ms 600 KB Output is correct
76 Partially correct 49 ms 2372 KB Partially correct - number of queries: 7018
77 Partially correct 58 ms 2624 KB Partially correct - number of queries: 8324
78 Correct 9 ms 1368 KB Output is correct
79 Correct 31 ms 2464 KB Output is correct
80 Partially correct 57 ms 2240 KB Partially correct - number of queries: 8300
81 Partially correct 50 ms 1984 KB Partially correct - number of queries: 8344
82 Partially correct 70 ms 2252 KB Partially correct - number of queries: 8228
83 Correct 2 ms 600 KB Output is correct
84 Partially correct 33 ms 1928 KB Partially correct - number of queries: 6837
85 Partially correct 49 ms 2132 KB Partially correct - number of queries: 8182
86 Incorrect 52 ms 748 KB Incorrect
87 Halted 0 ms 0 KB -