QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#220897 | #147. Floppy | Ahmed57# | Compile Error | / | / | C++23 | 1.1kb | 2023-10-20 22:47:39 | 2024-07-04 02:20:49 |
Judging History
floppy
#include <bits/stdc++.h>
using namespace std;
void save_to_floppy(const string &bits);
void read_array(int subtask_id,const vector<int> &v){
vector<pair<int,int>> xd;
for(int i = 0;i<v.size();i++)xd.push_back({v[i],i});
int e = log2(v.size());
sort(xd.begin(),xd.end());
reverse(xd.begin(),xd.end());
string b;
for(auto i : xd){
for(int d = e;d>=0;d--){
if(i.second&(1<<d))b+='1';
else b+='0';
}
}
save_to_floppy(b);
}
vector<int>solve_queries(int subtask_id,int N,const string &bits,const vector<int> &a,const vector<int> &b){
int x = log2(N);
int lol[N] = {0};
for(int i = 0;i<N;i++){
int id = 0;
for(int d = x;d>=0;d--){
if(bits[i*x+(x-d)]=='1')id&=(1<<d);
}
lol[id] = N-i-1;
}
vector<int> ans;
for(int i = 0;i<a.size();i++){
int ind = 0 , ma = -1;
for(int j = a[i];j<=b[i];j++){
if(ma<lol[j]){
ma = lol[j];
ind = j;
}
}
ans.push_back(ind);
}
return ans;
}
詳細信息
floppy.code: In function ‘void read_array(int, const std::vector<int>&)’: floppy.code:6:24: error: ‘>>’ should be ‘> >’ within a nested template argument list 6 | vector<pair<int,int>> xd; | ^~ | > > floppy.code:7:47: warning: extended initializer lists only available with ‘-std=c++11’ or ‘-std=gnu++11’ 7 | for(int i = 0;i<v.size();i++)xd.push_back({v[i],i}); | ^ floppy.code:7:55: warning: extended initializer lists only available with ‘-std=c++11’ or ‘-std=gnu++11’ 7 | for(int i = 0;i<v.size();i++)xd.push_back({v[i],i}); | ^ floppy.code:12:14: error: ‘i’ does not name a type 12 | for(auto i : xd){ | ^ floppy.code:17:6: error: expected ‘;’ before ‘save_to_floppy’ 17 | } | ^ | ; 18 | save_to_floppy(b); | ~~~~~~~~~~~~~~ floppy.code:18:19: error: could not convert ‘save_to_floppy(b)’ from ‘void’ to ‘bool’ 18 | save_to_floppy(b); | ~~~~~~~~~~~~~~^~~ | | | void floppy.code:19:1: error: expected primary-expression before ‘}’ token 19 | } | ^ floppy.code:18:23: error: expected ‘)’ before ‘}’ token 18 | save_to_floppy(b); | ^ | ) 19 | } | ~ floppy.code:12:8: note: to match this ‘(’ 12 | for(auto i : xd){ | ^ floppy.code:19:1: error: expected primary-expression before ‘}’ token 19 | } | ^ grader_floppy.cpp: In function ‘void my_fprintf(FILE*, const char*, ...)’: grader_floppy.cpp:17:9: error: ‘exit’ was not declared in this scope 17 | exit(0); | ^~~~ grader_floppy.cpp: In function ‘void my_fscanf(FILE*, int, const char*, ...)’: grader_floppy.cpp:26:9: error: ‘exit’ was not declared in this scope 26 | exit(0); | ^~~~ grader_floppy.cpp: In function ‘void save_to_floppy(const string&)’: grader_floppy.cpp:51:5: error: ‘exit’ was not declared in this scope 51 | exit(0); | ^~~~ grader_floppy.cpp: In function ‘int main(int, char**)’: grader_floppy.cpp:91:15: error: ‘atoi’ was not declared in this scope 91 | int run = atoi(argv[1]); | ^~~~