QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#323064#147. FloppySkyanCompile Error//C++231005b2024-02-08 12:11:422024-02-08 12:11:44

Judging History

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

  • [2024-02-08 12:11:44]
  • 评测
  • [2024-02-08 12:11:42]
  • 提交

floppy

#include <bits/stdc++.h>
#include "floppy.h"
using namespace std;
void read_array(int subtask_id, const vector<int> &v) {
    string res = "";
    stack<int> t;
    for (int i = 0; i < v.size(); i++) {
        while (!t.empty() && t.top() <= v[i]) {
            res += '0';
            t.pop();
        }
        t.push(v[i]);
        res += '1';
    }
    save_to_floppy(res);
}
vector<int> g[200005];
vector<int> solve_queries(int subtask_id, int N, const string &bits, const vector<int> &a, const vector<int> &b) {
    int n = bits.size(), q = a.size(), c = 0;
    vector<int> v, res(q);
    for (int i = 0; i < q; i++) {
        g[b[i]].push_back(i);
    }
    for (int i = 0; i < N; i++) {
        while (bits[c] == '0') {
            v.pop_back();
            c++;
        }
        v.push_back(i);
        for (int i = 0; i < g[i].size(); i++) {
            res[g[i]] = *lower_bound(v.begin(), v.end(), a[g[i]]);
        }
        c++;
    }
    return res;
}


详细

floppy.code: In function ‘std::vector<int> solve_queries(int, int, const string&, const std::vector<int>&, const std::vector<int>&)’:
floppy.code:31:16: error: no match for ‘operator[]’ (operand types are ‘std::vector<int>’ and ‘std::vector<int>’)
   31 |             res[g[i]] = *lower_bound(v.begin(), v.end(), a[g[i]]);
      |                ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from floppy.code:1:
/usr/include/c++/10/bits/stl_vector.h:1043:7: note: candidate: ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
 1043 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1043:28: note:   no known conversion for argument 1 from ‘std::vector<int>’ to ‘std::vector<int>::size_type’ {aka ‘long unsigned int’}
 1043 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1061:7: note: candidate: ‘std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
 1061 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1061:28: note:   no known conversion for argument 1 from ‘std::vector<int>’ to ‘std::vector<int>::size_type’ {aka ‘long unsigned int’}
 1061 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
floppy.code:31:59: error: no match for ‘operator[]’ (operand types are ‘const std::vector<int>’ and ‘std::vector<int>’)
   31 |             res[g[i]] = *lower_bound(v.begin(), v.end(), a[g[i]]);
      |                                                           ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from floppy.code:1:
/usr/include/c++/10/bits/stl_vector.h:1043:7: note: candidate: ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
 1043 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1043:28: note:   no known conversion for argument 1 from ‘std::vector<int>’ to ‘std::vector<int>::size_type’ {aka ‘long unsigned int’}
 1043 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1061:7: note: candidate: ‘std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::const_reference = const int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
 1061 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1061:28: note:   no known conversion for argument 1 from ‘std::vector<int>’ to ‘std::vector<int>::size_type’ {aka ‘long unsigned int’}
 1061 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
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]);
      |               ^~~~