# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
690601 |
2023-01-30T10:28:30 Z |
alexdd |
Mouse (info1cup19_mouse) |
C++17 |
|
52 ms |
208 KB |
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
int n;
vector<int> p;
bool done[300];
void solve(int N)
{
///reseteaza chestii
n=N;
p.clear();
for(int i=1;i<=n;i++)
{
done[i-1]=0;
done[i]=0;
p.push_back(i);
}
if(n<=2)
{
if(query(p)==n)
return;
swap(p[0],p[1]);
if(query(p)==n)
return;
}
while(1)
{
int x=query(p);
if(x==n)
return;
if(x==0)
break;
random_shuffle(p.begin(),p.end());
}
int cur=0,aux;
for(int i=0;i<n-2;i++)
{
if(done[i])
continue;
for(int j=i+1;j<n;j++)
{
if(done[j])
continue;
///verific daca p[j] ar trebui sa fie pe pozitia i
swap(p[j],p[i]);
aux=query(p);
if(aux==n)
return;
if(aux==cur)///nu ii bine
continue;
if(aux==cur+2)
{
done[i]=1;
done[j]=1;
cur=aux;
break;
}
///aux = cur+1
int ava=j+1;
if(j+1>=n)
ava=j-1;
swap(p[j],p[ava]);
if(query(p)==aux)
{
done[i]=1;
cur=aux;
break;
}
}
}
int x=query(p);
if(x==n)
return;
swap(p[n-2],p[n-1]);
x=query(p);
if(x==n)
return;
while(query(p)<n)
random_shuffle(p.begin(),p.end());
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
208 KB |
Correct! Number of queries: 3271 |
2 |
Correct |
0 ms |
208 KB |
Correct! Number of queries: 4 |
3 |
Correct |
5 ms |
208 KB |
Correct! Number of queries: 395 |
4 |
Correct |
3 ms |
208 KB |
Correct! Number of queries: 303 |
5 |
Correct |
52 ms |
208 KB |
Correct! Number of queries: 6672 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
208 KB |
Correct! Number of queries: 3271 |
2 |
Correct |
0 ms |
208 KB |
Correct! Number of queries: 4 |
3 |
Correct |
5 ms |
208 KB |
Correct! Number of queries: 395 |
4 |
Correct |
3 ms |
208 KB |
Correct! Number of queries: 303 |
5 |
Correct |
52 ms |
208 KB |
Correct! Number of queries: 6672 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
208 KB |
Correct! Number of queries: 3271 |
2 |
Correct |
0 ms |
208 KB |
Correct! Number of queries: 4 |
3 |
Correct |
5 ms |
208 KB |
Correct! Number of queries: 395 |
4 |
Correct |
3 ms |
208 KB |
Correct! Number of queries: 303 |
5 |
Correct |
52 ms |
208 KB |
Correct! Number of queries: 6672 |
6 |
Halted |
0 ms |
0 KB |
- |