답안 #227420

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
227420 2020-04-27T11:02:10 Z PedroBigMan 커다란 상품 (IOI17_prize) C++14
90 / 100
85 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 100000000000000000LL
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 12 ms 2548 KB Output is correct
2 Correct 14 ms 2548 KB Output is correct
3 Correct 11 ms 2548 KB Output is correct
4 Correct 13 ms 2548 KB Output is correct
5 Correct 9 ms 2548 KB Output is correct
6 Correct 11 ms 2548 KB Output is correct
7 Correct 12 ms 2548 KB Output is correct
8 Correct 12 ms 2532 KB Output is correct
9 Correct 12 ms 2548 KB Output is correct
10 Correct 13 ms 2548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 2548 KB Output is correct
2 Correct 10 ms 2548 KB Output is correct
3 Correct 12 ms 2548 KB Output is correct
4 Correct 11 ms 2548 KB Output is correct
5 Correct 13 ms 2548 KB Output is correct
6 Correct 12 ms 2548 KB Output is correct
7 Correct 11 ms 2548 KB Output is correct
8 Correct 9 ms 2676 KB Output is correct
9 Correct 13 ms 2548 KB Output is correct
10 Correct 12 ms 2548 KB Output is correct
11 Correct 17 ms 2548 KB Output is correct
12 Correct 12 ms 2540 KB Output is correct
13 Correct 16 ms 2540 KB Output is correct
14 Correct 23 ms 768 KB Output is correct
15 Partially correct 70 ms 2548 KB Partially correct - number of queries: 7434
16 Partially correct 74 ms 2548 KB Partially correct - number of queries: 7971
17 Partially correct 66 ms 2524 KB Partially correct - number of queries: 7815
18 Partially correct 72 ms 2548 KB Partially correct - number of queries: 8006
19 Partially correct 61 ms 2548 KB Partially correct - number of queries: 7362
20 Partially correct 41 ms 1528 KB Partially correct - number of queries: 5221
21 Partially correct 58 ms 2540 KB Partially correct - number of queries: 7772
22 Partially correct 57 ms 2540 KB Partially correct - number of queries: 5908
23 Correct 11 ms 2548 KB Output is correct
24 Correct 17 ms 2548 KB Output is correct
25 Partially correct 72 ms 2548 KB Partially correct - number of queries: 7829
26 Partially correct 77 ms 2548 KB Partially correct - number of queries: 7841
27 Correct 13 ms 2548 KB Output is correct
28 Partially correct 70 ms 2548 KB Partially correct - number of queries: 7839
29 Partially correct 71 ms 2548 KB Partially correct - number of queries: 6466
30 Partially correct 69 ms 2540 KB Partially correct - number of queries: 7943
31 Partially correct 67 ms 2548 KB Partially correct - number of queries: 7751
32 Correct 17 ms 2548 KB Output is correct
33 Correct 5 ms 256 KB Output is correct
34 Partially correct 69 ms 2524 KB Partially correct - number of queries: 7841
35 Correct 17 ms 2548 KB Output is correct
36 Partially correct 69 ms 2548 KB Partially correct - number of queries: 7756
37 Correct 18 ms 2548 KB Output is correct
38 Correct 11 ms 2548 KB Output is correct
39 Partially correct 65 ms 2548 KB Partially correct - number of queries: 7843
40 Partially correct 62 ms 2548 KB Partially correct - number of queries: 6871
41 Partially correct 76 ms 2540 KB Partially correct - number of queries: 7832
42 Partially correct 76 ms 2548 KB Partially correct - number of queries: 7832
43 Partially correct 63 ms 2548 KB Partially correct - number of queries: 7450
44 Partially correct 78 ms 2548 KB Partially correct - number of queries: 7874
45 Partially correct 68 ms 2540 KB Partially correct - number of queries: 7831
46 Partially correct 44 ms 2548 KB Partially correct - number of queries: 7798
47 Partially correct 69 ms 2548 KB Partially correct - number of queries: 7918
48 Partially correct 42 ms 2540 KB Partially correct - number of queries: 7950
49 Partially correct 49 ms 2540 KB Partially correct - number of queries: 7803
50 Partially correct 82 ms 2540 KB Partially correct - number of queries: 8007
51 Partially correct 62 ms 2548 KB Partially correct - number of queries: 7860
52 Partially correct 78 ms 2548 KB Partially correct - number of queries: 7794
53 Correct 13 ms 2548 KB Output is correct
54 Partially correct 77 ms 2548 KB Partially correct - number of queries: 7824
55 Partially correct 76 ms 2548 KB Partially correct - number of queries: 7803
56 Partially correct 78 ms 2548 KB Partially correct - number of queries: 8001
57 Partially correct 79 ms 2548 KB Partially correct - number of queries: 7863
58 Partially correct 80 ms 2540 KB Partially correct - number of queries: 7906
59 Partially correct 66 ms 2540 KB Partially correct - number of queries: 7819
60 Partially correct 43 ms 2564 KB Partially correct - number of queries: 7451
61 Correct 13 ms 2548 KB Output is correct
62 Correct 13 ms 2548 KB Output is correct
63 Correct 11 ms 2548 KB Output is correct
64 Correct 12 ms 2536 KB Output is correct
65 Correct 12 ms 2528 KB Output is correct
66 Correct 16 ms 2548 KB Output is correct
67 Correct 12 ms 2528 KB Output is correct
68 Correct 12 ms 2548 KB Output is correct
69 Correct 16 ms 2548 KB Output is correct
70 Correct 15 ms 2540 KB Output is correct
71 Partially correct 80 ms 2548 KB Partially correct - number of queries: 8270
72 Correct 16 ms 2548 KB Output is correct
73 Partially correct 85 ms 2548 KB Partially correct - number of queries: 8159
74 Partially correct 66 ms 2548 KB Partially correct - number of queries: 8219
75 Correct 12 ms 2548 KB Output is correct
76 Partially correct 69 ms 2548 KB Partially correct - number of queries: 7113
77 Partially correct 64 ms 2548 KB Partially correct - number of queries: 8011
78 Correct 16 ms 2548 KB Output is correct
79 Correct 43 ms 2548 KB Output is correct
80 Partially correct 72 ms 2548 KB Partially correct - number of queries: 8027
81 Partially correct 45 ms 2548 KB Partially correct - number of queries: 8052
82 Partially correct 79 ms 2548 KB Partially correct - number of queries: 7942
83 Correct 13 ms 2548 KB Output is correct
84 Partially correct 63 ms 2548 KB Partially correct - number of queries: 6622
85 Partially correct 74 ms 2548 KB Partially correct - number of queries: 7988
86 Correct 11 ms 2548 KB Output is correct
87 Correct 11 ms 2548 KB Output is correct
88 Correct 14 ms 2548 KB Output is correct
89 Correct 10 ms 2548 KB Output is correct
90 Correct 10 ms 2548 KB Output is correct
91 Correct 12 ms 2548 KB Output is correct
92 Correct 11 ms 2548 KB Output is correct
93 Correct 15 ms 2548 KB Output is correct
94 Correct 18 ms 2548 KB Output is correct
95 Correct 16 ms 2548 KB Output is correct
96 Correct 14 ms 2548 KB Output is correct
97 Correct 11 ms 2548 KB Output is correct