#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include "grader.h"
using namespace std;
vector < int > how;
vector < int > ans;
bool have[500]={0};
void solve(int N)
{
int a,b,c,now,i,j,k;
how.clear();
for(i=0;i<N;i++)
{
how.push_back(i+1);
have[i+1]=0;
}
for(i=0;i<N;i++)
{
//printf("aa\n");
for(j=1;j<=N;j++)
{
//printf("\n");
if(!have[j])
{
how[i]=j;
now=0;
for(k=1;k<=N;k++)
{
if(!have[k]&&k!=j)
{
how[i+now+1]=k;
now++;
}
}
a=query(how);
if(a==N) return;
swap(how[i],how[(i+1)%N]);
b=query(how);
if(b==N) return;
swap(how[i],how[(i+1)%N]);
swap(how[i],how[(i+2)%N]);
c=query(how);
if(c==N) return;
swap(how[i],how[(i+2)%N]);
//printf("%d %d %d\n",a,b,c);
if(a>b&&a>c)
{
//printf("%d %d\n",i,how[i]);
have[how[i]]=1;
break;
}
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |