답안 #315228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315228 2020-10-22T05:01:41 Z thtsshz_bgwrswh Mouse (info1cup19_mouse) C++17
31.6552 / 100
3000 ms 256 KB
#pragma GCC optimize("Ofast")
#include "grader.h"
#include<stdio.h>
#include<algorithm>
#include<assert.h>
using namespace std;
int num[500];
bool check[500],wrong[500];
void solve(int n){
	int i,j;
	for(i=0;i<n;i++)
		wrong[i]=check[i]=0;
	vector<int> vec(n);
	for(i=0;i<n;i++)
		vec[i]=i+1;
//	random_shuffle(vec.begin(),vec.end());
	int now=query(vec);
	if(now==n)
		return;
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			swap(vec[j],vec[i]);
			int v=query(vec);
			if(v==n)
				return;
			if(v==now-2)
				check[i]=check[j]=1;
			else if(v==now)
				wrong[i]=wrong[j]=1;
			swap(vec[i],vec[j]);
		}
	} 
	vector<int> order;
	for(i=0;i<n;i++)
		if(wrong[i])
			order.emplace_back(i);
	for(i=0;i<n;i++)
		check[i]=0;
	while(1){
		for(i=0;i<(int)order.size();i++){
			for(j=i+1;j<(int)order.size();j++){
				if(check[i]||check[j])
					continue;
				swap(vec[order[i]],vec[order[j]]);
				int v=query(vec);
				if(v==n)
					return;
				if(v==now+2){
					now+=2;
					check[i]=check[j]=1;
					break;
				}
				else if(v==now+1)
					now++;	
				else
					swap(vec[order[i]],vec[order[j]]);
			}
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Correct! Number of queries: 33
2 Correct 1 ms 256 KB Correct! Number of queries: 12
3 Correct 1 ms 256 KB Correct! Number of queries: 31
4 Correct 1 ms 256 KB Correct! Number of queries: 40
5 Correct 1 ms 256 KB Correct! Number of queries: 32
6 Correct 1 ms 256 KB Correct! Number of queries: 28
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Correct! Number of queries: 33
2 Correct 1 ms 256 KB Correct! Number of queries: 12
3 Correct 1 ms 256 KB Correct! Number of queries: 31
4 Correct 1 ms 256 KB Correct! Number of queries: 40
5 Correct 1 ms 256 KB Correct! Number of queries: 32
6 Correct 1 ms 256 KB Correct! Number of queries: 28
7 Correct 35 ms 256 KB Correct! Number of queries: 2500
8 Correct 42 ms 256 KB Correct! Number of queries: 2500
9 Correct 29 ms 256 KB Correct! Number of queries: 2100
10 Correct 35 ms 256 KB Correct! Number of queries: 2500
11 Correct 22 ms 256 KB Correct! Number of queries: 1800
12 Correct 41 ms 256 KB Correct! Number of queries: 2400
13 Correct 26 ms 256 KB Correct! Number of queries: 2100
14 Correct 32 ms 256 KB Correct! Number of queries: 2400
15 Correct 41 ms 256 KB Correct! Number of queries: 2400
16 Correct 38 ms 256 KB Correct! Number of queries: 2300
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Correct! Number of queries: 33
2 Correct 1 ms 256 KB Correct! Number of queries: 12
3 Correct 1 ms 256 KB Correct! Number of queries: 31
4 Correct 1 ms 256 KB Correct! Number of queries: 40
5 Correct 1 ms 256 KB Correct! Number of queries: 32
6 Correct 1 ms 256 KB Correct! Number of queries: 28
7 Correct 35 ms 256 KB Correct! Number of queries: 2500
8 Correct 42 ms 256 KB Correct! Number of queries: 2500
9 Correct 29 ms 256 KB Correct! Number of queries: 2100
10 Correct 35 ms 256 KB Correct! Number of queries: 2500
11 Correct 22 ms 256 KB Correct! Number of queries: 1800
12 Correct 41 ms 256 KB Correct! Number of queries: 2400
13 Correct 26 ms 256 KB Correct! Number of queries: 2100
14 Correct 32 ms 256 KB Correct! Number of queries: 2400
15 Correct 41 ms 256 KB Correct! Number of queries: 2400
16 Correct 38 ms 256 KB Correct! Number of queries: 2300
17 Execution timed out 3097 ms 256 KB Time limit exceeded
18 Halted 0 ms 0 KB -