QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#862462#8812. Library 3sichengzhouCompile Error//C++17449b2025-01-19 01:37:112025-01-19 01:37:13

Judging History

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

  • [2025-01-19 01:37:13]
  • 评测
  • [2025-01-19 01:37:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
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]);
    //  answer(b);
      ret=query(b);
      if(ret<cur)
      {
          cur=ret;
          x=j;
      }else{
        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:8:11: error: ‘query’ was not declared in this scope
    8 |   int ret=query(b);
      |           ^~~~~
answer.code:25:3: error: ‘answer’ was not declared in this scope
   25 |   answer(b);
      |   ^~~~~~