답안 #1113620

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113620 2024-11-16T20:17:51 Z epicci23 커다란 상품 (IOI17_prize) C++17
90 / 100
174 ms 2048 KB
#include "bits/stdc++.h"
#include "prize.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
 
const int BL = 10000;

int suf = -1;
vector<int> Cache = {-1, -1};
map<int,vector<int>> dp;
 
vector<int> Ask(int i){
  if( dp.count(i) ) return dp[i];
  return dp[i] = ask(i);
}
 
int Learn(int l,int r){
  if(l>r) return -1;

  if(l==r){
    auto u = Ask(l);
    if(u[0] + u[1] == 0) return l;
    if(u[1] == suf) Cache=u;
    else suf--;
    return -1;
  }

  auto X = Ask(r);
  if(X[0] + X[1] == 0) return r;
  if(X[1] == suf) return -1;
  int mid = (l+r) / 2;
  auto u = Ask(mid);
  if(u[0] + u[1] == 0) return mid;
  if(u[1] == suf) return Learn(mid + 1, r - 1);
  int lf = Learn(l,mid - 1);
  if(lf != -1) return lf;
  if(u[1]==suf) Cache = u;
  else suf--; 
  if(X[1] == suf - ( Cache[0] + Cache[1] > X[0] + X[1] ) ) return -1;
  int hm = Learn( mid + 1, r - 1 );
  if(hm != -1) return hm;
  if(X[1] == suf) Cache = X;
  else suf--;
  return -1;
}
 
int find_best(int n){
  int art = 0;
  for(int i = 0; i <= 475; i++){
  	if(art == 5) return Learn(i, n - 1);
    vector<int> x = Ask(i);
    if(x[0] + x[1] == 0) return i;
    if(x[0] + x[1] > Cache[0] + Cache[1]) art++;
    if(x[0] + x[1] >= Cache[0] + Cache[1]){
      Cache = x;
      suf = Cache[1];
    }
    else suf--;
  }
  return Learn(476, n - 1 );
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 336 KB Output is correct
2 Correct 10 ms 1244 KB Output is correct
3 Correct 8 ms 336 KB Output is correct
4 Correct 9 ms 336 KB Output is correct
5 Correct 8 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 8 ms 336 KB Output is correct
8 Correct 8 ms 448 KB Output is correct
9 Correct 8 ms 592 KB Output is correct
10 Correct 10 ms 704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 592 KB Output is correct
2 Correct 9 ms 336 KB Output is correct
3 Correct 9 ms 336 KB Output is correct
4 Correct 9 ms 336 KB Output is correct
5 Correct 8 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 9 ms 592 KB Output is correct
8 Correct 9 ms 336 KB Output is correct
9 Correct 9 ms 592 KB Output is correct
10 Correct 7 ms 336 KB Output is correct
11 Correct 12 ms 504 KB Output is correct
12 Correct 8 ms 336 KB Output is correct
13 Correct 16 ms 336 KB Output is correct
14 Correct 13 ms 504 KB Output is correct
15 Correct 25 ms 744 KB Output is correct
16 Partially correct 132 ms 1568 KB Partially correct - number of queries: 6701
17 Correct 7 ms 336 KB Output is correct
18 Partially correct 141 ms 1692 KB Partially correct - number of queries: 7958
19 Correct 8 ms 336 KB Output is correct
20 Correct 36 ms 552 KB Output is correct
21 Correct 55 ms 880 KB Output is correct
22 Correct 17 ms 780 KB Output is correct
23 Correct 9 ms 336 KB Output is correct
24 Correct 8 ms 444 KB Output is correct
25 Correct 62 ms 1032 KB Output is correct
26 Correct 70 ms 1396 KB Output is correct
27 Correct 10 ms 500 KB Output is correct
28 Partially correct 131 ms 1260 KB Partially correct - number of queries: 6830
29 Partially correct 107 ms 940 KB Partially correct - number of queries: 5342
30 Partially correct 159 ms 1328 KB Partially correct - number of queries: 7959
31 Correct 7 ms 592 KB Output is correct
32 Correct 18 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 44 ms 1188 KB Output is correct
35 Correct 11 ms 592 KB Output is correct
36 Correct 30 ms 548 KB Output is correct
37 Correct 13 ms 504 KB Output is correct
38 Correct 10 ms 604 KB Output is correct
39 Correct 68 ms 828 KB Output is correct
40 Partially correct 137 ms 1660 KB Partially correct - number of queries: 7032
41 Correct 87 ms 1040 KB Output is correct
42 Correct 93 ms 956 KB Output is correct
43 Correct 73 ms 892 KB Output is correct
44 Correct 51 ms 588 KB Output is correct
45 Correct 44 ms 760 KB Output is correct
46 Correct 8 ms 504 KB Output is correct
47 Correct 64 ms 1020 KB Output is correct
48 Partially correct 110 ms 1116 KB Partially correct - number of queries: 5852
49 Correct 16 ms 848 KB Output is correct
50 Partially correct 129 ms 2048 KB Partially correct - number of queries: 8004
51 Correct 51 ms 708 KB Output is correct
52 Correct 9 ms 504 KB Output is correct
53 Correct 12 ms 504 KB Output is correct
54 Correct 61 ms 724 KB Output is correct
55 Correct 7 ms 336 KB Output is correct
56 Partially correct 138 ms 1252 KB Partially correct - number of queries: 8029
57 Partially correct 94 ms 1096 KB Partially correct - number of queries: 5662
58 Partially correct 85 ms 1264 KB Partially correct - number of queries: 5805
59 Correct 88 ms 1200 KB Output is correct
60 Correct 78 ms 1068 KB Output is correct
61 Correct 12 ms 336 KB Output is correct
62 Correct 8 ms 336 KB Output is correct
63 Correct 12 ms 336 KB Output is correct
64 Correct 11 ms 592 KB Output is correct
65 Correct 10 ms 336 KB Output is correct
66 Correct 9 ms 336 KB Output is correct
67 Correct 11 ms 600 KB Output is correct
68 Correct 8 ms 592 KB Output is correct
69 Correct 18 ms 336 KB Output is correct
70 Correct 9 ms 336 KB Output is correct
71 Partially correct 161 ms 1432 KB Partially correct - number of queries: 9050
72 Correct 24 ms 696 KB Output is correct
73 Partially correct 174 ms 1668 KB Partially correct - number of queries: 8938
74 Partially correct 162 ms 1688 KB Partially correct - number of queries: 8986
75 Correct 12 ms 504 KB Output is correct
76 Partially correct 159 ms 1464 KB Partially correct - number of queries: 7898
77 Partially correct 158 ms 1476 KB Partially correct - number of queries: 8156
78 Correct 22 ms 984 KB Output is correct
79 Correct 78 ms 1268 KB Output is correct
80 Partially correct 169 ms 1456 KB Partially correct - number of queries: 8140
81 Partially correct 162 ms 1940 KB Partially correct - number of queries: 8164
82 Partially correct 157 ms 1512 KB Partially correct - number of queries: 8190
83 Correct 12 ms 492 KB Output is correct
84 Partially correct 122 ms 1568 KB Partially correct - number of queries: 6830
85 Partially correct 153 ms 1712 KB Partially correct - number of queries: 8203
86 Correct 10 ms 592 KB Output is correct
87 Correct 9 ms 336 KB Output is correct
88 Correct 11 ms 592 KB Output is correct
89 Correct 9 ms 336 KB Output is correct
90 Correct 10 ms 336 KB Output is correct
91 Correct 9 ms 848 KB Output is correct
92 Correct 10 ms 336 KB Output is correct
93 Correct 15 ms 592 KB Output is correct
94 Correct 22 ms 528 KB Output is correct
95 Correct 17 ms 336 KB Output is correct
96 Correct 15 ms 508 KB Output is correct
97 Correct 8 ms 848 KB Output is correct