답안 #1015069

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015069 2024-07-06T04:12:43 Z emptypringlescan Mouse (info1cup19_mouse) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
void solve(int n){
	mt19937 rng(999);
	int perm[n];
	for(int i=0; i<n; i++) perm[i]=i+1;
	shuffle(perm,perm+n);
	vector<int> adj[n];
	vector<int> v;
	for(int i=0; i<n; i++) v.push_back(perm[i]);
	int x=query(v);
	int done[n];
	memset(done,0,sizeof(done));
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			swap(v[i],v[j]);
			int y=query(v);
			if(y==n) return;
			if(y>x){
				x=y;
				continue;
			}
			swap(v[i],v[j]);
		}
	}
}

Compilation message

mouse.cpp: In function 'void solve(int)':
mouse.cpp:8:21: error: no matching function for call to 'shuffle(int [n], int*)'
    8 |  shuffle(perm,perm+n);
      |                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from mouse.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3748:5: note: candidate: 'template<class _RAIter, class _UGenerator> void std::shuffle(_RAIter, _RAIter, _UGenerator&&)'
 3748 |     shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~~~~
/usr/include/c++/10/bits/stl_algo.h:3748:5: note:   template argument deduction/substitution failed:
mouse.cpp:8:21: note:   candidate expects 3 arguments, 2 provided
    8 |  shuffle(perm,perm+n);
      |                     ^