#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
const int N=43001;
set<int> ss,tmp;
int query(int x)
{
int ans=Query(x);
if(ss.find(x)!=ss.end()) ss.erase(x);
else ss.insert(x);
return ans;
}
vector< pair<int,int> > ans;
void Solve(int n)
{
int las=0,cur;
for(int i=1;i<=2*n;i++)
{
cur=query(i);
/*if(i==6)
{
cout << "GOT: " << las << " " << cur << endl;
for(auto it:ss)
cout << it << endl;
}*/
if(cur==las)
{
//cout << i << " " << cur << endl;
las=cur;
while(ss.size())
{
int ce=*ss.begin();
cur=query(ce);
if(cur==las)
{
ans.push_back({ce,i});
cur=query(i);
break;
}
else
{
tmp.insert(ce);
las=cur;
}
}
while(tmp.size())
{
cur=query(*tmp.begin());
tmp.erase(tmp.begin());
}
}
las=cur;
}
for(auto i:ans)
{
//cout << i.first << " " << i.second << endl;
Answer(i.first,i.second);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
83 ms |
392 KB |
Output is correct |
2 |
Incorrect |
159 ms |
504 KB |
Wrong Answer [2] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
5 |
Correct |
83 ms |
392 KB |
Output is correct |
6 |
Incorrect |
159 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
5 |
Correct |
83 ms |
392 KB |
Output is correct |
6 |
Incorrect |
159 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
5 |
Correct |
83 ms |
392 KB |
Output is correct |
6 |
Incorrect |
159 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
5 |
Correct |
83 ms |
392 KB |
Output is correct |
6 |
Incorrect |
159 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
5 |
Correct |
83 ms |
392 KB |
Output is correct |
6 |
Incorrect |
159 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
5 |
Correct |
83 ms |
392 KB |
Output is correct |
6 |
Incorrect |
159 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
5 |
Correct |
83 ms |
392 KB |
Output is correct |
6 |
Incorrect |
159 ms |
504 KB |
Wrong Answer [2] |
7 |
Halted |
0 ms |
0 KB |
- |