Submission #1076203

# Submission time Handle Problem Language Result Execution time Memory
1076203 2024-08-26T11:44:27 Z amin The Big Prize (IOI17_prize) C++14
20 / 100
64 ms 6948 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 j=sqrt(n);
        int r=min(n-cur,j);
        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:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 5 ms 5208 KB Output is correct
2 Correct 19 ms 3672 KB Output is correct
3 Correct 13 ms 5208 KB Output is correct
4 Correct 38 ms 1880 KB Output is correct
5 Correct 13 ms 1880 KB Output is correct
6 Correct 1 ms 1880 KB Output is correct
7 Correct 13 ms 1880 KB Output is correct
8 Correct 8 ms 3672 KB Output is correct
9 Correct 15 ms 3692 KB Output is correct
10 Correct 21 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1880 KB Output is correct
2 Correct 20 ms 3672 KB Output is correct
3 Correct 13 ms 3672 KB Output is correct
4 Correct 27 ms 5208 KB Output is correct
5 Correct 16 ms 5304 KB Output is correct
6 Correct 1 ms 3504 KB Output is correct
7 Correct 16 ms 3672 KB Output is correct
8 Correct 12 ms 3668 KB Output is correct
9 Correct 15 ms 5208 KB Output is correct
10 Correct 26 ms 5196 KB Output is correct
11 Correct 15 ms 6744 KB Output is correct
12 Correct 2 ms 5208 KB Output is correct
13 Correct 26 ms 3672 KB Output is correct
14 Correct 3 ms 2392 KB Output is correct
15 Correct 9 ms 5208 KB Output is correct
16 Partially correct 42 ms 6744 KB Partially correct - number of queries: 6381
17 Correct 1 ms 5372 KB Output is correct
18 Partially correct 54 ms 5208 KB Partially correct - number of queries: 7683
19 Correct 1 ms 5208 KB Output is correct
20 Correct 12 ms 6744 KB Output is correct
21 Correct 17 ms 5460 KB Output is correct
22 Correct 7 ms 6948 KB Output is correct
23 Correct 5 ms 3672 KB Output is correct
24 Correct 1 ms 5300 KB Output is correct
25 Partially correct 32 ms 5208 KB Partially correct - number of queries: 5343
26 Partially correct 28 ms 5208 KB Partially correct - number of queries: 5179
27 Correct 9 ms 5208 KB Output is correct
28 Partially correct 64 ms 3672 KB Partially correct - number of queries: 9411
29 Partially correct 36 ms 3672 KB Partially correct - number of queries: 7669
30 Partially correct 45 ms 5208 KB Partially correct - number of queries: 7560
31 Correct 2 ms 6744 KB Output is correct
32 Correct 16 ms 3672 KB Output is correct
33 Correct 0 ms 2392 KB Output is correct
34 Correct 12 ms 3508 KB Output is correct
35 Correct 16 ms 5208 KB Output is correct
36 Correct 11 ms 3672 KB Output is correct
37 Correct 7 ms 5208 KB Output is correct
38 Correct 3 ms 3672 KB Output is correct
39 Correct 19 ms 3668 KB Output is correct
40 Incorrect 63 ms 1880 KB Incorrect
41 Halted 0 ms 0 KB -