답안 #247367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
247367 2020-07-11T09:00:05 Z errorgorn Mouse (info1cup19_mouse) C++14
25.2069 / 100
3000 ms 1912 KB
#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;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Correct! Number of queries: 37
2 Correct 5 ms 256 KB Correct! Number of queries: 15
3 Correct 4 ms 256 KB Correct! Number of queries: 13
4 Correct 5 ms 256 KB Correct! Number of queries: 27
5 Correct 7 ms 304 KB Correct! Number of queries: 28
6 Correct 5 ms 384 KB Correct! Number of queries: 20
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Correct! Number of queries: 37
2 Correct 5 ms 256 KB Correct! Number of queries: 15
3 Correct 4 ms 256 KB Correct! Number of queries: 13
4 Correct 5 ms 256 KB Correct! Number of queries: 27
5 Correct 7 ms 304 KB Correct! Number of queries: 28
6 Correct 5 ms 384 KB Correct! Number of queries: 20
7 Correct 104 ms 396 KB Correct! Number of queries: 5500
8 Correct 97 ms 376 KB Correct! Number of queries: 5800
9 Correct 37 ms 256 KB Correct! Number of queries: 2400
10 Correct 49 ms 376 KB Correct! Number of queries: 2900
11 Correct 34 ms 256 KB Correct! Number of queries: 2000
12 Correct 57 ms 376 KB Correct! Number of queries: 3400
13 Correct 49 ms 376 KB Correct! Number of queries: 3100
14 Correct 58 ms 376 KB Correct! Number of queries: 4100
15 Correct 96 ms 376 KB Correct! Number of queries: 5800
16 Correct 68 ms 384 KB Correct! Number of queries: 4800
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Correct! Number of queries: 37
2 Correct 5 ms 256 KB Correct! Number of queries: 15
3 Correct 4 ms 256 KB Correct! Number of queries: 13
4 Correct 5 ms 256 KB Correct! Number of queries: 27
5 Correct 7 ms 304 KB Correct! Number of queries: 28
6 Correct 5 ms 384 KB Correct! Number of queries: 20
7 Correct 104 ms 396 KB Correct! Number of queries: 5500
8 Correct 97 ms 376 KB Correct! Number of queries: 5800
9 Correct 37 ms 256 KB Correct! Number of queries: 2400
10 Correct 49 ms 376 KB Correct! Number of queries: 2900
11 Correct 34 ms 256 KB Correct! Number of queries: 2000
12 Correct 57 ms 376 KB Correct! Number of queries: 3400
13 Correct 49 ms 376 KB Correct! Number of queries: 3100
14 Correct 58 ms 376 KB Correct! Number of queries: 4100
15 Correct 96 ms 376 KB Correct! Number of queries: 5800
16 Correct 68 ms 384 KB Correct! Number of queries: 4800
17 Execution timed out 3083 ms 1912 KB Time limit exceeded
18 Halted 0 ms 0 KB -