제출 #1328270

#제출 시각아이디문제언어결과실행 시간메모리
1328270Mamikonm1게임 (IOI13_game)C++17
컴파일 에러
0 ms0 KiB
#include<bits//stdc++.h>
#include "game.h"
using namespace std;
using ll = long long;
long long GCD(long long X, long long Y) {
    return(Y?GCD(Y,X%Y):X);
}
vector<vector<ll>>a;
void init(int R, int C) {
    a.resize(R,vector<int>(C));
}

void update(int P, int Q, long long K) {
    a[P][Q]=K;
}

long long calculate(int P, int Q, int U, int V) {
    ll res=0;
    for(int i=P;i<=U;++i){
        for(int j=Q;j<=V;++j){
            res=GCD(res,a[i][j]);
        }
    }
    return res;
}

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'void init(int, int)':
game.cpp:10:13: error: no matching function for call to 'std::vector<std::vector<long long int> >::resize(int&, std::vector<int>)'
   10 |     a.resize(R,vector<int>(C));
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from game.cpp:1:
/usr/include/c++/13/bits/stl_vector.h:1013:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; size_type = long unsigned int]'
 1013 |       resize(size_type __new_size)
      |       ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:1013:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/13/bits/stl_vector.h:1034:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(size_type, const value_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; size_type = long unsigned int; value_type = std::vector<long long int>]'
 1034 |       resize(size_type __new_size, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/13/bits/stl_vector.h:1034:54: note:   no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<long long int> >::value_type&' {aka 'const std::vector<long long int>&'}
 1034 |       resize(size_type __new_size, const value_type& __x)
      |                                    ~~~~~~~~~~~~~~~~~~^~~