답안 #315273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315273 2020-10-22T07:55:08 Z Seanliu Mouse (info1cup19_mouse) C++14
0 / 100
1 ms 256 KB
#include <iostream>
#include <vector>
#include "grader.h"
using namespace std;

const int maxN = 326;
int ans[maxN], ANS[maxN], N;
bool has[maxN];

/*
int query(vector<int> q){
	int ans = 0;
	//cout << "Asking: ";
	for(int i = 0; i < N; i++){
		//cout << q[i] << " ";
		ans += (q[i] == ANS[i]);
	}
	//cout << endl;
	return ans;
}
*/


void solve(int N){
	vector<int> q;	
	for(int i = 0; i < N; i++){
		fill(has, has + N + 1, false);
		vector<int>().swap(q);
		for(int j = 0; j < i; j++){
			q.push_back(ans[j]); 
			has[ans[j]] = true;
		}
		for(int j = 1; j <= N; j++) if(!has[j]){
			q.push_back(j);
		}
		int baseline = query(q);
		if(baseline == N) return;
		int asked = i;
		for(int j = i + 1; j < N; j++){
			swap(q[j], q[i]);
			int res = query(q);
			if(res == N) return;
			if(res > baseline){
				asked = j;
				baseline = res;
			}
			swap(q[j], q[i]);
		}
		//cout << "ans[" << i << "] = " << q[asked] << endl;
		ans[i] = q[asked];
	}
	vector<int>().swap(q);
	q.resize(N);
	for(int i = 0; i < N; i++) q[i] = ans[i];
	query(q);
	return;
}

/*
int main(){
	cin >> N;
	for(int i = 0; i < N; i++) cin >> ANS[i];
	solve(N);
}
*/

# 결과 실행 시간 메모리 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 -