답안 #1076185

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

for(int i=0;i<n;i++)
{
    a[i]=-1;
    b[i]=-1;
}
q=ask(0);
a[0]=q[0];
b[0]=q[1];
    while(cur!=n)
    {
      //  cout<<cur<<endl;

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


           q=ask(cur+mid);
           a[cur+mid]=q[0];
           b[cur+mid]=q[1];
            }
           if(p==a[cur+mid]&&pp==b[cur+mid])
           {
               l=mid;
           }else
           r=mid;
        }
        cur=r+cur;
    }

}

Compilation message

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