답안 #227463

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
227463 2020-04-27T13:40:59 Z PedroBigMan 커다란 상품 (IOI17_prize) C++14
90 / 100
109 ms 2676 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include "prize.h"
using namespace std;
typedef int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll)a; i<(ll)b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 1000000000000LL
ll insig;
#define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);}
void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}

int find_best(int n) 
{
	ll N=(ll) n;
    vector<pl> query; REP(i,0,N) {query.pb(mp(-1,-1));}
    vector<ll> spe;
    ll n_spe=0LL;
    REP(i,0,min(500,N)) 
    {
        vector<int> q=ask(i); query[i]=mp(q[0],q[1]);
        n_spe=max(n_spe,q[0]+q[1]);
    }
    REP(i,0,min(500,N))
    {
        if(query[i].ff+query[i].ss!=n_spe) {spe.pb(i);}
    }
    while((ll) spe.size()!=n_spe)
    {
        ll lo=0LL;
        if(spe.size()>0) {lo=spe[spe.size()-1]+1;} 
        ll hi=N-1;
        while(lo<hi)
        {
            ll mid=(lo+hi)/2LL;
            if(query[mid].ff==-1) {vector<int> q=ask(mid); query[mid]=mp(q[0],q[1]);}
            if(query[mid].ff+query[mid].ss!=n_spe) {hi=mid; continue;}
            if(query[mid].ff>spe.size()) {hi=mid-1;}
            else {lo=mid+1;}
        }
        spe.pb(lo);
    }
    REP(i,0,spe.size()) 
    {
        ll ind=spe[i];
        if(query[ind].ff==-1) {vector<int> q=ask(ind); query[ind]=mp(q[0],q[1]);}
        if(query[ind].ff==0 && query[ind].ss==0) {return ind;}
    }
    return 0LL;
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:56:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(query[mid].ff>spe.size()) {hi=mid-1;}
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 2548 KB Output is correct
2 Correct 14 ms 2548 KB Output is correct
3 Correct 9 ms 2548 KB Output is correct
4 Correct 13 ms 2548 KB Output is correct
5 Correct 11 ms 2540 KB Output is correct
6 Correct 14 ms 2548 KB Output is correct
7 Correct 14 ms 2540 KB Output is correct
8 Correct 12 ms 2548 KB Output is correct
9 Correct 9 ms 2548 KB Output is correct
10 Correct 14 ms 2548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 2548 KB Output is correct
2 Correct 15 ms 2548 KB Output is correct
3 Correct 13 ms 2548 KB Output is correct
4 Correct 11 ms 2528 KB Output is correct
5 Correct 12 ms 2548 KB Output is correct
6 Correct 13 ms 2548 KB Output is correct
7 Correct 13 ms 2548 KB Output is correct
8 Correct 12 ms 2472 KB Output is correct
9 Correct 12 ms 2548 KB Output is correct
10 Correct 14 ms 2548 KB Output is correct
11 Correct 23 ms 2548 KB Output is correct
12 Correct 17 ms 2540 KB Output is correct
13 Correct 12 ms 2540 KB Output is correct
14 Correct 32 ms 768 KB Output is correct
15 Partially correct 62 ms 2548 KB Partially correct - number of queries: 7434
16 Partially correct 68 ms 2564 KB Partially correct - number of queries: 7971
17 Partially correct 90 ms 2548 KB Partially correct - number of queries: 7815
18 Partially correct 76 ms 2548 KB Partially correct - number of queries: 8006
19 Partially correct 59 ms 2540 KB Partially correct - number of queries: 7362
20 Partially correct 44 ms 1528 KB Partially correct - number of queries: 5221
21 Partially correct 75 ms 2548 KB Partially correct - number of queries: 7772
22 Partially correct 55 ms 2548 KB Partially correct - number of queries: 5908
23 Correct 15 ms 2548 KB Output is correct
24 Correct 21 ms 2540 KB Output is correct
25 Partially correct 107 ms 2548 KB Partially correct - number of queries: 7829
26 Partially correct 51 ms 2676 KB Partially correct - number of queries: 7841
27 Correct 10 ms 2540 KB Output is correct
28 Partially correct 69 ms 2548 KB Partially correct - number of queries: 7839
29 Partially correct 64 ms 2548 KB Partially correct - number of queries: 6466
30 Partially correct 58 ms 2676 KB Partially correct - number of queries: 7943
31 Partially correct 66 ms 2548 KB Partially correct - number of queries: 7751
32 Correct 12 ms 2528 KB Output is correct
33 Correct 6 ms 256 KB Output is correct
34 Partially correct 101 ms 2540 KB Partially correct - number of queries: 7841
35 Correct 11 ms 2548 KB Output is correct
36 Partially correct 98 ms 2548 KB Partially correct - number of queries: 7756
37 Correct 21 ms 2540 KB Output is correct
38 Correct 16 ms 2548 KB Output is correct
39 Partially correct 43 ms 2540 KB Partially correct - number of queries: 7843
40 Partially correct 55 ms 2548 KB Partially correct - number of queries: 6871
41 Partially correct 54 ms 2540 KB Partially correct - number of queries: 7832
42 Partially correct 104 ms 2548 KB Partially correct - number of queries: 7832
43 Partially correct 62 ms 2548 KB Partially correct - number of queries: 7450
44 Partially correct 63 ms 2540 KB Partially correct - number of queries: 7874
45 Partially correct 68 ms 2540 KB Partially correct - number of queries: 7831
46 Partially correct 43 ms 2540 KB Partially correct - number of queries: 7798
47 Partially correct 50 ms 2540 KB Partially correct - number of queries: 7918
48 Partially correct 66 ms 2548 KB Partially correct - number of queries: 7950
49 Partially correct 69 ms 2540 KB Partially correct - number of queries: 7803
50 Partially correct 68 ms 2548 KB Partially correct - number of queries: 8007
51 Partially correct 84 ms 2528 KB Partially correct - number of queries: 7860
52 Partially correct 96 ms 2676 KB Partially correct - number of queries: 7794
53 Correct 12 ms 2548 KB Output is correct
54 Partially correct 98 ms 2540 KB Partially correct - number of queries: 7824
55 Partially correct 87 ms 2548 KB Partially correct - number of queries: 7803
56 Partially correct 65 ms 2528 KB Partially correct - number of queries: 8001
57 Partially correct 68 ms 2548 KB Partially correct - number of queries: 7863
58 Partially correct 70 ms 2548 KB Partially correct - number of queries: 7906
59 Partially correct 99 ms 2548 KB Partially correct - number of queries: 7819
60 Partially correct 42 ms 2544 KB Partially correct - number of queries: 7451
61 Correct 14 ms 2548 KB Output is correct
62 Correct 15 ms 2540 KB Output is correct
63 Correct 14 ms 2540 KB Output is correct
64 Correct 16 ms 2548 KB Output is correct
65 Correct 10 ms 2524 KB Output is correct
66 Correct 19 ms 2540 KB Output is correct
67 Correct 11 ms 2540 KB Output is correct
68 Correct 16 ms 2548 KB Output is correct
69 Correct 12 ms 2548 KB Output is correct
70 Correct 17 ms 2544 KB Output is correct
71 Partially correct 109 ms 2548 KB Partially correct - number of queries: 8270
72 Correct 20 ms 2548 KB Output is correct
73 Partially correct 71 ms 2548 KB Partially correct - number of queries: 8159
74 Partially correct 105 ms 2548 KB Partially correct - number of queries: 8219
75 Correct 12 ms 2548 KB Output is correct
76 Partially correct 85 ms 2548 KB Partially correct - number of queries: 7113
77 Partially correct 105 ms 2548 KB Partially correct - number of queries: 8011
78 Correct 20 ms 2548 KB Output is correct
79 Correct 39 ms 2548 KB Output is correct
80 Partially correct 98 ms 2548 KB Partially correct - number of queries: 8027
81 Partially correct 73 ms 2532 KB Partially correct - number of queries: 8052
82 Partially correct 63 ms 2548 KB Partially correct - number of queries: 7942
83 Correct 15 ms 2548 KB Output is correct
84 Partially correct 65 ms 2676 KB Partially correct - number of queries: 6622
85 Partially correct 99 ms 2548 KB Partially correct - number of queries: 7988
86 Correct 14 ms 2548 KB Output is correct
87 Correct 12 ms 2548 KB Output is correct
88 Correct 12 ms 2548 KB Output is correct
89 Correct 16 ms 2596 KB Output is correct
90 Correct 12 ms 2548 KB Output is correct
91 Correct 15 ms 2548 KB Output is correct
92 Correct 11 ms 2548 KB Output is correct
93 Correct 14 ms 2548 KB Output is correct
94 Correct 14 ms 2548 KB Output is correct
95 Correct 16 ms 2548 KB Output is correct
96 Correct 14 ms 2472 KB Output is correct
97 Correct 12 ms 2548 KB Output is correct