Submission #1283989

#TimeUsernameProblemLanguageResultExecution timeMemory
1283989icebearSelotejp (COCI20_selotejp)C++20
Compilation error
0 ms0 KiB
// ~~ icebear ~~ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef pair<int, ii> iii; template<class T> bool minimize(T &a, const T &b) { if (a > b) return a = b, true; return false; } template<class T> bool maximize(T &a, const T &b) { if (a < b) return a = b, true; return false; } #define FOR(i,a,b) for(int i=(a); i<=(b); ++i) #define FORR(i,a,b) for(int i=(a); i>=(b); --i) #define REP(i, n) for(int i=0; i<(n); ++i) #define RED(i, n) for(int i=(n)-1; i>=0; --i) #define MASK(i) (1LL << (i)) #define BIT(S, i) (((S) >> (i)) & 1) #define mp make_pair #define pb push_back #define fi first #define se second #define all(x) x.begin(), x.end() #define task "icebear" /*END OF TEMPLATE. ICEBEAR AND THE CAT WILL WIN VOI26 */ const int MOD = 1e9 + 7; const int inf = 0x3f3f3f3f; const ll INF = 1e18 + 27092008; const int N = 1000 + 5; int n, m, f[N][15][MASK(10)]; char a[N][15]; void init(void) { cin >> n >> m; REP(i, n) REP(j, m) cin >> a[i][j]; } void process(void) { memset(f, 0x3f, sizeof f); f[0][0][0] = 0; REP(i, n) REP(j, m) REP(mask, MASK(m)) if (f[i][j][mask] != inf) { if (a[i][j] == '#') { // col if (BIT(mask, j)) { minimize(f[i][j + 1][mask], f[i][j][mask]); } else { minimize(f[i][j + 1][mask | MASK(j)], f[i][j][mask] + 1); } int off = min(mask, mask ^ MASK(j)); // row if (j > 0 && a[i][j - 1] == '#' && BIT(mask, j - 1) == 0) { minimize(f[i][j + 1][off], f[i][j][mask]); } else { minimize(f[i][j + 1][off], f[i][j][mask] + 1); } } else { int off = min(mask, mask ^ MASK(j)); minimize(f[i][j + 1][off], f[i][j][mask]); } REP(mask, MASK(m)) f[i + 1][0][mask] = f[i][m][mask]; } int ans = inf; REP(mask, MASK(m)) minimize(ans, f[n][0][mask]); cout << ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } int tc = 1; // cin >> tc; while(tc--) { init(); process(); } return 0; }

Compilation message (stderr)

Main.cpp: In function 'void process()':
Main.cpp:59:26: error: no matching function for call to 'min(int&, long long int)'
   59 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from Main.cpp:2:
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
Main.cpp:59:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   59 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
Main.cpp:59:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   59 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
Main.cpp:59:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   59 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
Main.cpp:59:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   59 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:67:26: error: no matching function for call to 'min(int&, long long int)'
   67 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
Main.cpp:67:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   67 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
Main.cpp:67:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   67 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
Main.cpp:67:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   67 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
Main.cpp:67:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   67 |             int off = min(mask, mask ^ MASK(j));
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:82:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   82 |         freopen(task".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:83:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   83 |         freopen(task".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~