QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#461302 | #8812. Library 3 | thangthang | Compile Error | / | / | C++20 | 772b | 2024-07-02 17:35:50 | 2024-07-02 17:35:52 |
Judging History
answer
#include <bits/stdc++.h>
#include "library3.h"
using namespace std;
void solve(int N){
vector <int> ans;
for (int i = 0; i < N; ++ i) ans.push_back(i);
int last = query(ans);
for (int i = 1; i < N; ++ i){
int cur = i;
int l = 0;
int r = i - 1;
while (l <= r){
int mid = l + r >> 1;
vector <int> ask = ans;
ask[0] = ans[i];
for (int i = 1; i <= mid; ++ i) ask[i] = ans[i - 1];
ask[i] = ans[0];
if (query(ask) > last + mid){
cur = mid;
r = mid - 1;
}
else l = mid + 1;
}
swap(ans[i], ans[cur]);
last = query(ans);
}
return ans;
}
詳細信息
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:31:12: error: return-statement with a value, in function returning ‘void’ [-fpermissive] 31 | return ans; | ^~~