답안 #674444

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674444 2022-12-24T09:02:43 Z QwertyPi Mouse (info1cup19_mouse) C++14
0 / 100
1 ms 208 KB
#include <bits/stdc++.h>
using namespace std;

#ifndef TEST
#include "grader.h"
int query(vector<int> q);
#else
vector<int> p;

int qc = 0;
int query(vector<int> q){
	qc++;
	int cnt = 0;
	int n = p.size();
	for(int i = 0; i < n; i++){
		if(p[i] == q[i]) cnt++;
	}
	return cnt;
}
#endif

void solve(int N){
	vector<int> a;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	for(int i = 1; i <= N; i++){
		a.push_back(i);
	}
	for(int i = 0; i < N; i++){
		swap(a[i], a[rng() % (i + 1)]);
	}
	int qry = 0;
	for(int i = 0; i < N; i++){
		for(int j = i + 1; j < N; j++){
			swap(a[i], a[j]);
			int new_qry = query(a);
			if(new_qry < qry) swap(a[i], a[j]);
			else qry = new_qry;
		}
	}
}

#ifdef TEST
int main(){
	int N; cin >> N; p.resize(N);
	for(int i = 0; i < N; i++) cin >> p[i];
	solve(N);
	cout << qc << endl;
}
#endif
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct! Number of queries: 20
2 Correct 0 ms 208 KB Correct! Number of queries: 5
3 Runtime error 1 ms 208 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct! Number of queries: 20
2 Correct 0 ms 208 KB Correct! Number of queries: 5
3 Runtime error 1 ms 208 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct! Number of queries: 20
2 Correct 0 ms 208 KB Correct! Number of queries: 5
3 Runtime error 1 ms 208 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -