제출 #1015067

#제출 시각아이디문제언어결과실행 시간메모리
1015067emptypringlescanMouse (info1cup19_mouse)C++17
컴파일 에러
0 ms0 KiB
#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=0; 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]); } } }

컴파일 시 표준 에러 (stderr) 메시지

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);
      |                     ^