답안 #55460

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55460 2018-07-07T15:18:39 Z BThero Bomb (IZhO17_bomb) C++17
컴파일 오류
0 ms 0 KB
// Why I am so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;
                    
short up[2505][2505];

short dw[2505][2505];

char s[2505][2505];

int f[2505];

int n, m, ans;

void solve() {
    scanf("%d %d", &n, &m);

    for (int i = 1; i <= n; ++i) {
        scanf("%s", s[i] + 1);
    }

    int limh = n, limw = m;

    for (int i = 1; i <= n; ++i) {
        int cur = 0;

        for (int j = 1; j <= m; ++j) {
            if (s[i][j] == '1') {
                ++cur;

                if (j == m || s[i][j + 1] == '0') {
                    limw = min(limw, cur);
                }
            }   
            else {
                cur = 0;
            }
        }    
    }

    for (int j = 1; j <= m; ++j) {
        int cur = 0;

        for (int i = 1; i <= n; ++i) {
            if (s[i][j] == '1') {
                up[i][j] = ++cur;

                if (i == n || s[i + 1][j] == '0') {
                    limh = min(limh, cur);
                }
            }
            else {
                cur = 0;
            }
        }
    }

    for (int j = 1; j <= m; ++j) {
        int cur = 0;

        for (int i = n; i > 0; --i) {
            if (s[i][j] == '1') {
                dw[i][j] = ++cur;
            }
            else {
                cur = 0;
            }
        }
    }

    for (int i = 1; i <= limw; ++i) {
        f[i] = limh;
    }

    for (int i = 1; i <= n; ++i) {
        int cur = 0, l = 100000, r = 100000;

        for (int j = 1; j <= m; ++j) {
            if (s[i][j] == '1') {
                ++cur;

                l = min(l, up[i][j]);
                r = min(r, dw[i][j]);

                f[cur] = min(f[cur], l + r - 1);
            }
            else {
                cur = 0;
                l = r = 100000;
            }
        }
    }

    for (int i = 1; i <= n; ++i) {
        int cur = 0, l = 100000, r = 100000;

        for (int j = m; j > 0; --j) {
            if (s[i][j] == '1') {
                ++cur;

                l = min(l, up[i][j]);
                r = min(r, dw[i][j]);

                f[cur] = min(f[cur], l + r - 1);
            }
            else {
                cur = 0;
                l = r = 100000;
            }
        }
    }

    ans = f[1];                    

    for (int i = 2; i <= limw; ++i) {
        f[i] = min(f[i], f[i - 1]);
        ans = max(ans, i * f[i]);
    }

    printf("%d\n", ans);
}

int main() {
    //freopen("bomb.in", "r", stdin);
    //freopen("bomb.out", "w", stdout);
          
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Compilation message

bomb.cpp: In function 'void solve()':
bomb.cpp:93:36: error: no matching function for call to 'min(int&, short int&)'
                 l = min(l, up[i][j]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
bomb.cpp:93:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
                 l = min(l, up[i][j]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
bomb.cpp:93:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
                 l = min(l, up[i][j]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
bomb.cpp:93:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                 l = min(l, up[i][j]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
bomb.cpp:93:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                 l = min(l, up[i][j]);
                                    ^
bomb.cpp:94:36: error: no matching function for call to 'min(int&, short int&)'
                 r = min(r, dw[i][j]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
bomb.cpp:94:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
                 r = min(r, dw[i][j]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
bomb.cpp:94:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
                 r = min(r, dw[i][j]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
bomb.cpp:94:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                 r = min(r, dw[i][j]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
bomb.cpp:94:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                 r = min(r, dw[i][j]);
                                    ^
bomb.cpp:112:36: error: no matching function for call to 'min(int&, short int&)'
                 l = min(l, up[i][j]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
bomb.cpp:112:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
                 l = min(l, up[i][j]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
bomb.cpp:112:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
                 l = min(l, up[i][j]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
bomb.cpp:112:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                 l = min(l, up[i][j]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
bomb.cpp:112:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                 l = min(l, up[i][j]);
                                    ^
bomb.cpp:113:36: error: no matching function for call to 'min(int&, short int&)'
                 r = min(r, dw[i][j]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
bomb.cpp:113:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
                 r = min(r, dw[i][j]);
                                    ^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
                 from /usr/include/c++/7/cmath:1914,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
bomb.cpp:113:36: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
                 r = min(r, dw[i][j]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
bomb.cpp:113:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                 r = min(r, dw[i][j]);
                                    ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from bomb.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
bomb.cpp:113:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                 r = min(r, dw[i][j]);
                                    ^
bomb.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
bomb.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", s[i] + 1);
         ~~~~~^~~~~~~~~~~~~~~~