Submission #659212

#TimeUsernameProblemLanguageResultExecution timeMemory
659212jiahngThe Big Prize (IOI17_prize)C++14
0 / 100
87 ms328 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef vector <int> vi; typedef vector <pi> vpi; typedef pair<pi, ll> pii; typedef set <ll> si; typedef long double ld; #define f first #define s second #define mp make_pair #define FOR(i,s,e) for(int i=s;i<=int(e);++i) #define DEC(i,s,e) for(int i=s;i>=int(e);--i) #define pb push_back #define all(x) (x).begin(), (x).end() #define lbd(x, y) lower_bound(all(x), y) #define ubd(x, y) upper_bound(all(x), y) #define aFOR(i,x) for (auto i: x) #define mem(x,i) memset(x,i,sizeof x) #define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define maxn 200010 #define INF (ll)1e9 #define MOD 1000000007 typedef pair <vi, int> pvi; typedef pair <int,pi> ipi; typedef vector <pii> vpii; int N; int find_best(int n) { N = n; pi lollipop = pi(-1,-1); FOR(i,0,min(N-1,499)){ vi v = ask(i); lollipop = max(lollipop, pi(v[0] + v[1], -i)); } int x = lollipop.s; int tar = lollipop.s; vi non_lollipops; FOR(i,0,x-1) non_lollipops.pb(i); while (x < N){ DEC(i,30,0) if (x + (1<<i) < N){ vi v = ask(x+(1<<i)); if (v[0] == tar && v[0] + v[1] == lollipop.f) x += (1 << i); } x++; while (x < N){ vi v = ask(x); if (v[0] + v[1] == lollipop.f) break; non_lollipops.pb(x); x++; tar++; } } aFOR(i, non_lollipops){ //cout << i << ' '; vi v = ask(i); if (v[0] + v[1] == 0) return i; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...