Problem: [here](https://codeforces.net/problemset/problem/1520/F2)↵
↵
Submission link: [here](https://codeforces.net/contest/1520/submission/129747143)↵
↵
Why I think it shouldn't exceed the limit:↵
↵
Let's look at my `query` function (it does the queries):↵
↵
<spoiler summary="function code">↵
↵
~~~~~↵
int query(int l, int r){↵
queryCount++; // counts the number of queries currently done↵
curQueries++; // counts the number of queries for each k value from input↵
// there are t k values in total t<=10^4↵
assert(curQueries<=2); ↵
// for each k value, number of queries shouldn't be bigger than 2↵
// this assert doesn't get me a runtime error↵
cout<<"? "<<l<<" "<<r<<endl;↵
int x; cin>>x;↵
assert(x!= -1); ↵
// checks this, because the statement mentions, that otherwise an arbitrary verdict could be displayed↵
return x;↵
}↵
~~~~~↵
</spoiler>↵
↵
now the `solve` function:↵
↵
<spoiler summary="solve() code">↵
↵
~~~~~↵
void solve(){↵
// some other code...↵
assert(queryCount <= buildQueries);// buildQueries = 4e4↵
_for(g, 0, t){ // g[0, t-1] (done t<=10^4 times)↵
curQueries = 0; // begin to count curQueries each time↵
int tAns = solveGroup(); // here some number of queries is being done↵
cout<<"! "<<tAns<<endl;↵
setForNextT();↵
if(g!= t-1) cin>>K;↵
}↵
return;↵
}↵
~~~~~↵
↵
↵
</spoiler>↵
↵
So, I don't get a runtime error due to the assertions.↵
But it should work, because $t<=10^4$ times we do at most $2$ queries, and we do also some build queries, which are $\leq 4\cdot10^4$.↵
$2\cdot 10^4 + 4\cdot 10^4 = 6\cdot 10^4$, which is the maximal number of queries possible. ↵
Have you got any ideas what's wrong here?↵
Help would be really appreciated.↵
Thank you.
↵
Submission link: [here](https://codeforces.net/contest/1520/submission/129747143)↵
↵
Why I think it shouldn't exceed the limit:↵
↵
Let's look at my `query` function (it does the queries):↵
↵
<spoiler summary="function code">↵
↵
~~~~~↵
int query(int l, int r){↵
queryCount++; // counts the number of queries currently done↵
curQueries++; // counts the number of queries for each k value from input↵
// there are t k values in total t<=10^4↵
assert(curQueries<=2); ↵
// for each k value, number of queries shouldn't be bigger than 2↵
// this assert doesn't get me a runtime error↵
cout<<"? "<<l<<" "<<r<<endl;↵
int x; cin>>x;↵
assert(x!= -1); ↵
// checks this, because the statement mentions, that otherwise an arbitrary verdict could be displayed↵
return x;↵
}↵
~~~~~↵
</spoiler>↵
↵
now the `solve` function:↵
↵
<spoiler summary="solve() code">↵
↵
~~~~~↵
void solve(){↵
// some other code...↵
assert(queryCount <= buildQueries);// buildQueries = 4e4↵
_for(g, 0, t){ // g[0, t-1] (done t<=10^4 times)↵
curQueries = 0; // begin to count curQueries each time↵
int tAns = solveGroup(); // here some number of queries is being done↵
cout<<"! "<<tAns<<endl;↵
setForNextT();↵
if(g!= t-1) cin>>K;↵
}↵
return;↵
}↵
~~~~~↵
↵
↵
</spoiler>↵
↵
So, I don't get a runtime error due to the assertions.↵
But it should work, because $t<=10^4$ times we do at most $2$ queries, and we do also some build queries, which are $\leq 4\cdot10^4$.↵
$2\cdot 10^4 + 4\cdot 10^4 = 6\cdot 10^4$, which is the maximal number of queries possible. ↵
Have you got any ideas what's wrong here?↵
Help would be really appreciated.↵
Thank you.