답안 #1115414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115414 2024-11-20T12:47:59 Z staszic_ojuz Dango Maker (JOI18_dango_maker) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

vector<string> plansza;
int64_t tab[3001][3001];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        plansza.push_back(s);
    }
    int64_t wyn = 0;
    for(int i = n - 1; i >= 0; i--){
        for(int j = m - 1; j >= 0; j--){
            if(plansza[i][j] == 'R'){
                if(i < n - 2){
                    if(plansza[i + 1][j] == 'G' && plansza[i + 2][j] == 'W'){
                        if(tab[i + 1][j] == 0){
                            if(tab[i + 2][j] == 0){
                                tab[i][j]++;
                                tab[i + 1][j] = j + i * 3001;
                                tab[i + 2][j] = j + i * 3001;
                            }else{
                                if(tab[i + 2][j - 1] == 0){
                                    tab[i][j]++;
                                }
                            }
                        }else{
                            if(tab[i + 2][j] == 0){
                                tab[i + 2][j] = 0;
                            }else{
                                continue;
                            }
                        }

                    }
                }
                if(j < m - 2 && tab[i][j] == 0){
                    if(plansza[i][j + 1] == 'G' && plansza[i][j + 2] == 'W'){
                        tab[i][j]++;
                        tab[i][j + 1] = j + i * 3001;
                        tab[i][j + 2] = j + i * 3001;
                    }
                }
            wyn += min(1, tab[i][j]);
            }
        }
    }
    cout << wyn;
}

Compilation message

dango_maker.cpp: In function 'int main()':
dango_maker.cpp:51:36: error: no matching function for call to 'min(int, int64_t&)'
   51 |             wyn += min(1, tab[i][j]);
      |                                    ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from dango_maker.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
dango_maker.cpp:51:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'int64_t' {aka 'long int'})
   51 |             wyn += min(1, tab[i][j]);
      |                                    ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from dango_maker.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
dango_maker.cpp:51:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'int64_t' {aka 'long int'})
   51 |             wyn += min(1, tab[i][j]);
      |                                    ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dango_maker.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
dango_maker.cpp:51:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   51 |             wyn += min(1, tab[i][j]);
      |                                    ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dango_maker.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
dango_maker.cpp:51:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   51 |             wyn += min(1, tab[i][j]);
      |                                    ^