제출 #247367

#제출 시각아이디문제언어결과실행 시간메모리
247367errorgornMouse (info1cup19_mouse)C++14
25.21 / 100
3083 ms1912 KiB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

#define ii pair<int,int> 
#define ll long long
#define fi first
#define se second 
 
#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
mt19937 rng (42069);

set<ii> tested;

void solve(int n){
	vector<int> v;
	
	rep(x,1,n+1){
		v.push_back(x);
	}
	
	int curr=query(v);
	
	while (curr!=n){
		int i,j;
		
		do{
			i=rng()%n,j=rng()%n;
			if (i>j) swap(i,j);
		} while (i==j && !tested.count(ii(i,j)));
		
		swap(v[i],v[j]);
		int temp=query(v);
		if (temp<curr){
			swap(v[i],v[j]);
			tested.insert(ii(i,j));
		}
		else{
			tested.clear();
			curr=temp;
		}
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...