QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#466545#5029. 在路上lbrlbrCompile Error//C++14602b2024-07-07 22:00:592024-07-07 22:01:00

Judging History

你现在查看的是最新测评结果

  • [2024-07-07 22:01:00]
  • 评测
  • [2024-07-07 22:00:59]
  • 提交

answer

#include"path.h"
#include<bits/stdc++.h>
int ask(int x,int y,int z);
int centroid(int id,int N,int M);

int jh[5];
int st[1000009];
bool cmp(int a,int b){
	int x=ask(a,b,st[1]);
	return x==a;
}
int centroid(int id,int N,int M){
	if(N==3)return ask(1,2,3);
	int cnt=0;
	for(int i=1;i<=N;++i){
		jh[++cnt]=i;
		int jb;
		if(cnt==3){
			jb=ask(jh[1],jh[2],jh[3]);
			for(int i=1;i<=3;++i){
				if(jh[i]==jb){
					swap(jh[i],jh[3]);
					continue;
				}
			}
			--cnt;
		}
		st[i]=i;
	}
	swap(st[1],st[jh[1]]);
	nth_element(st+2,st+2+N/2,st+2+N-1,cmp);
	return st[N/2+1];
}

Details

implementer.cpp: In function ‘int main()’:
implementer.cpp:60:14: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   60 |         fread(Interactor::rbuf,1,50000000,stdin);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code: In function ‘int centroid(int, int, int)’:
answer.code:22:41: error: ‘swap’ was not declared in this scope
   22 |                                         swap(jh[i],jh[3]);
      |                                         ^~~~
answer.code:22:41: note: suggested alternatives:
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181,
                 from answer.code:2:
/usr/include/c++/13/bits/regex.h:2230:5: note:   ‘std::__cxx11::swap’
 2230 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/13/bits/stl_pair.h:61,
                 from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/move.h:189:5: note:   ‘std::swap’
  189 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
In file included from /usr/include/c++/13/exception:164,
                 from /usr/include/c++/13/stdexcept:38,
                 from /usr/include/c++/13/system_error:43,
                 from /usr/include/c++/13/bits/ios_base.h:46,
                 from /usr/include/c++/13/streambuf:43,
                 from /usr/include/c++/13/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/13/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:54:
/usr/include/c++/13/bits/exception_ptr.h:230:5: note:   ‘std::__exception_ptr::swap’
  230 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
answer.code:30:9: error: ‘swap’ was not declared in this scope
   30 |         swap(st[1],st[jh[1]]);
      |         ^~~~
answer.code:30:9: note: suggested alternatives:
/usr/include/c++/13/bits/regex.h:2230:5: note:   ‘std::__cxx11::swap’
 2230 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/13/bits/move.h:189:5: note:   ‘std::swap’
  189 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/13/bits/exception_ptr.h:230:5: note:   ‘std::__exception_ptr::swap’
  230 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
answer.code:31:9: error: ‘nth_element’ was not declared in this scope; did you mean ‘std::nth_element’?
   31 |         nth_element(st+2,st+2+N/2,st+2+N-1,cmp);
      |         ^~~~~~~~~~~
      |         std::nth_element
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:4813:5: note: ‘std::nth_element’ declared here
 4813 |     nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth,
      |     ^~~~~~~~~~~