답안 #1076140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1076140 2024-08-26T11:24:00 Z amin 커다란 상품 (IOI17_prize) C++14
20 / 100
58 ms 344 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>q;
int find_best(int n) {
    int cur=0;

    while(cur!=n)
    {
       // cout<<cur<<endl;
 q=ask(cur);

 int p=q[0];
 int pp=q[1];
 if(p==0&&pp==0)
    return cur;
        int l=0;
        int r=n-cur;
        while(l<r-1)
        {
            int mid=(l+r)/2;
           q=ask(cur+mid);
           if(p==q[0]&&pp==q[1])
           {
               l=mid;
           }else
           r=mid;
        }
        cur=r+cur;
    }

}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 3 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 4 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 7 ms 344 KB Output is correct
16 Incorrect 58 ms 340 KB Incorrect
17 Halted 0 ms 0 KB -