QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#862440#8812. Library 3sichengzhouCompile Error//C++17437b2025-01-19 01:16:432025-01-19 01:16:44

Judging History

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

  • [2025-01-19 01:16:44]
  • 评测
  • [2025-01-19 01:16:43]
  • 提交

answer

#include "library3.h"

#include <bits/stdc++.h>

void solve(int N) {
  std::vector<int> b(N, 0);
  for (int i = 0; i < N; i++) {
    b[i] = i;
  }
  int ret=query(b);
  for (int i = 0; i < N; i++){
  int x=i,cur=ret;
  for (int j = i+1; j < N; j++){
      swap(b[i],b[j]);
      ret=query(b);
      if(ret<cur)
      {
          cur=ret;
          x=j;
      }
      swap(b[i],b[j]);
  }
  swap(b[i],b[j]);
  ret=cur;
  }
  answer(b);
}

詳細信息

implementer.cpp: In function ‘int query(std::vector<int>)’:
implementer.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d",&ret);
      |         ~~~~~^~~~~~~~~~~
implementer.cpp: In function ‘int main()’:
implementer.cpp:24:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
answer.code: In function ‘void solve(int)’:
answer.code:14:7: error: ‘swap’ was not declared in this scope
   14 |       swap(b[i],b[j]);
      |       ^~~~
answer.code:14:7: note: suggested alternatives:
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
                 from answer.code:3:
/usr/include/c++/14/bits/regex.h:2230:5: note:   ‘std::__cxx11::swap’
 2230 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/vector:62,
                 from library3.h:1,
                 from answer.code:1:
/usr/include/c++/14/bits/move.h:213:5: note:   ‘std::swap’
  213 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:213:5: note:   ‘std::swap’
In file included from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/stdexcept:38,
                 from /usr/include/c++/14/system_error:43,
                 from /usr/include/c++/14/bits/ios_base.h:46,
                 from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/exception_ptr.h:230:5: note:   ‘std::__exception_ptr::swap’
  230 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
In file included from /usr/include/c++/14/filesystem:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_path.h:736:15: note:   ‘std::filesystem::__cxx11::swap’
  736 |   inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
      |               ^~~~
answer.code:23:15: error: ‘j’ was not declared in this scope
   23 |   swap(b[i],b[j]);
      |               ^
answer.code:23:3: error: ‘swap’ was not declared in this scope
   23 |   swap(b[i],b[j]);
      |   ^~~~
answer.code:23:3: note: suggested alternatives:
/usr/include/c++/14/bits/regex.h:2230:5: note:   ‘std::__cxx11::swap’
 2230 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
/usr/include/c++/14/bits/move.h:213:5: note:   ‘std::swap’
  213 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:213:5: note:   ‘std::swap’
/usr/include/c++/14/bits/exception_ptr.h:230:5: note:   ‘std::__exception_ptr::swap’
  230 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
/usr/include/c++/14/bits/fs_path.h:736:15: note:   ‘std::filesystem::__cxx11::swap’
  736 |   inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
      |               ^~~~