编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#1839 #997. 内讧 Compile Error 0 0 ms 0 K C++ 17 / 326 B s230026047 2023-10-15 16:56:00
显示原始代码
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
    int n, m, counter;
    vector<int> metrix(n)(m);
    vector<int> temp(2);

    // input
    cin >> n >> m;
    // input into the matrix for the photos.
    for (int i : n) {
        for (int j : m) {
            cin >> metrix[i][j];
        }
    }
    // check
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:7:23: error: expected ',' or ';' before '(' token
    7 |  vector<int> metrix(n)(m);
      |                       ^
/sandbox/1/a.cpp:14:15: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   14 |  for (int i : n){
      |               ^
      |               std::begin
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from /sandbox/1/a.cpp:1:
/usr/include/c++/10/bits/range_access.h:108:37: note: 'std::begin' declared here
  108 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
      |                                     ^~~~~
/sandbox/1/a.cpp:14:15: error: 'end' was not declared in this scope; did you mean 'std::end'?
   14 |  for (int i : n){
      |               ^
      |               std::end
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from /sandbox/1/a.cpp:1:
/usr/include/c++/10/bits/range_access.h:110:37: note: 'std::end' declared here
  110 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
      |                                     ^~~
/sandbox/1/a.cpp:15:16: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   15 |   for (int j : m){
      |                ^
      |                std::begin
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from /sandbox/1/a.cpp:1:
/usr/include/c++/10/bits/range_access.h:108:37: note: 'std::begin' declared here
  108 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
      |                                     ^~~~~
/sandbox/1/a.cpp:15:16: error: 'end' was not declared in this scope; did you mean 'std::end'?
   15 |   for (int j : m){
      |                ^
      |                std::end
In file included from /usr/include/c++/10/string:54,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from /sandbox/1/a.cpp:1:
/usr/include/c++/10/bits/range_access.h:110:37: note: 'std::end' declared here
  110 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
      |                                     ^~~
/sandbox/1/a.cpp:16:20: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   16 |    cin >> metrix[i][j];
      |                    ^