Submission #103174

#TimeUsernameProblemLanguageResultExecution timeMemory
103174daniel920712커다란 상품 (IOI17_prize)C++14
20 / 100
70 ms3556 KiB
#include <iostream> #include <stdio.h> #include <math.h> #include <assert.h> #include "prize.h" using namespace std; int all[200005]; int l[200005],r[200005]; int find_best(int n) { vector < int > t; int i,x=floor(sqrt(n)),j,all=0; for(i=0;i<n;i+=x) { //printf("%d\n",i); t=ask(i); all++; l[i]=t[0]; r[i]=t[1]; if(l[i]==0&&r[i]==0) return i; } for(i=x;i<n;i+=x) { if(i+x>=n&&r[i]) { for(j=i+1;j<n;j++) { all++; assert(all<10000); t=ask(j); l[j]=t[0]; r[j]=t[1]; if(l[j]==0&&r[j]==0) return j; } } else { if(r[i]!=r[i+x]||l[i]+r[i]!=l[i+x]+r[i+x]) { for(j=i+1;j<i+x;j++) { all++; assert(all<10000); t=ask(j); l[j]=t[0]; r[j]=t[1]; if(l[j]==0&&r[j]==0) return j; } } } } }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...