Submission #397286

#TimeUsernameProblemLanguageResultExecution timeMemory
397286idk321The Big Prize (IOI17_prize)C++11
20 / 100
106 ms328 KiB
        #include "prize.h"
         
        #include <bits/stdc++.h>
        using namespace std;
        typedef long long ll;
        int n;
         
        pair<int, vector<int>> differentRight(int a, vector<int> inf)
        {
          	
            int b = min(n - 1, a + 200);
            int myb = b + 1;
            int res = -1;
            vector<int> rinf;
            a++;
            while (a <= b)
            {
                int mid = (a + b) / 2;
                vector<int> cinf = ask(mid);
                if (cinf == inf)
                {
                    a = mid + 1;
                } else
                {
                    res = mid;
                    rinf = cinf;
                    b = mid - 1;
                }
            }
         	
          	if (res == -1)
            {
            	res = b + 1;
              	rinf = ask(res);
            }
            return {res, rinf};
        }
         
        int find_best(int N) {
            n = N;
            /*
            if (n <= 5000)
            {
                int res = -1;
                for (int i = 0; i < n; i++)
                {
                    vector<int> v = ask(i);
                    if (v[0] == 0 && v[1] == 0) res = i;
                }
         
                return res;
            } */
         
         
            int ca = 0;
            vector<int> inf = ask(0);
            vector<int> needed = {0, 0};
            while(inf != needed)
            {
                auto p1 = differentRight(ca, inf);
                ca = p1.first;
                inf = p1.second;
            }
         
         
         
        	return ca;
        }

Compilation message (stderr)

prize.cpp: In function 'std::pair<int, std::vector<int> > differentRight(int, std::vector<int>)':
prize.cpp:12:17: warning: unused variable 'myb' [-Wunused-variable]
   12 |             int myb = b + 1;
      |                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...