Submission #103168

#TimeUsernameProblemLanguageResultExecution timeMemory
103168daniel920712커다란 상품 (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <stdio.h> #include <math.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)); for(i=0;i<n;i+=x) { printf("%d\n",i); t=ask(i); 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++) { t=ask(j); l[j]=t[0]; r[j]=t[1]; if(l[j]==0&&r[j]==0) return i; } } 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++) { t=ask(j); l[j]=t[0]; r[j]=t[1]; if(l[j]==0&&r[j]==0) return i; } } } } }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:25:17: error: 'j' was not declared in this scope
             for(j=i+1;j<n;j++)
                 ^
prize.cpp:37:21: error: 'j' was not declared in this scope
                 for(j=i+1;j<i+x;j++)
                     ^
prize.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^