Submission #1114101

#TimeUsernameProblemLanguageResultExecution timeMemory
1114101adiyerBomb (IZhO17_bomb)C++17
Compilation error
0 ms0 KiB
// 194.67 #pragma optimize ("g",on) #pragma GCC optimize("inline") #pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize ("03") // #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native") #include <bits/stdc++.h> #define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout); #define adiyer(); ios_base::sync_with_stdio(0); cin.tie(0); #define bitcount(n) __builtin_popcountll(n) #define puts(x) cout << (x ? "YES\n" : "NO\n"); #define ent (i == n ? '\n' : ' ') #define all(x) x.begin(), x.end() #define md ((l + r) >> 1) #define rv(v) ((v << 1) | 1) #define lv(v) (v << 1) #define rs(v) rv(v), md + 1, r #define ls(v) lv(v), l, md #define len(s) (int) s.size() #define yes { cout << "YES\n"; return; } #define no { cout << "NO\n"; return; } #define skip continue #define pb push_back #define S second #define F first #define ne != // #define int long long using namespace std; typedef int ll; typedef long double ld; typedef vector < ll > vll; typedef pair < ll, ll > pll; typedef vector < pair < ll, ll > > vpll; const int dx[8] = {-1, 0, 1, 0, 1, 1, -1, -1}; const int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1}; const int N = 2.5e3 + 5; const int K = 1e5 + 3; const int MAX = 1e6; const int mod = 998244353; const long long inf = 2e9; const long long one = 1; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); ll n, m, w, h; ll a[N][N], pref[N][N]; int st[N][N]; char c; ll get(ll l1, ll r1, ll l2, ll r2){ return pref[l2][r2] - pref[l1 - 1][r2] - pref[l2][r1 - 1] + pref[l1 - 1][r1 - 1]; } bool f(ll W, ll H){ memset(st, 0, sizeof(st)); for(ll i = 1; i <= n; i++){ for(ll j = 1; j <= m; j++){ if(get(i, j, i + H - 1, j + W - 1) >= H * W){ st[i][j]++; st[i + H][j]--; st[i][j + W]--; st[i + H][j + W]++; } st[i][j] += st[i - 1][j] + st[i][j - 1] - st[i - 1][j - 1]; if(a[i][j] && !st[i][j]) return 0; } } return 1; } long long ff(ll H){ ll l = 0, r = m + 1; while(r - l > 1){ if(f(md, H)) l = md; else r = md; } return one * l * H; } void output(){ cin >> n >> m, w = m, h = n; for(ll i = 1; i <= n; i++) for(ll j = 1; j <= m; j++) cin >> c, a[i][j] = c - '0'; for(ll i = 1; i <= n; i++) for(ll j = 1; j <= m; j++) pref[i][j] = pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + a[i][j]; ll l = 0, r = n + 1; while(r - l > 2){ ll m1 = l + (r - l) / 3; ll m2 = r - (r - l) / 3; if(ff(m1) < ff(m2)) l = m1; else r = m2; } long long ans = 0; for(ll i = max(1ll, l - 50); i <= min(n, r + 50); i++) ans = max(ans, ff(i)); cout << ans; } const bool cases = 0; signed main(){ // file("disrupt"); adiyer(); int tt = 1; if(cases) cin >> tt; for(int i = 1; i <= tt; i++){ // cout << "Case " << i << ":\n"; output(); // slow(); // stress(); } }

Compilation message (stderr)

bomb.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize ("g",on)
      | 
bomb.cpp: In function 'void output()':
bomb.cpp:106:28: error: no matching function for call to 'max(long long int, ll)'
  106 |  for(ll i = max(1ll, l - 50); i <= min(n, r + 50); i++) ans = max(ans, ff(i));
      |                            ^
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 bomb.cpp:9:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
bomb.cpp:106:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'int'})
  106 |  for(ll i = max(1ll, l - 50); i <= min(n, r + 50); i++) ans = max(ans, ff(i));
      |                            ^
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 bomb.cpp:9:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
bomb.cpp:106:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'll' {aka 'int'})
  106 |  for(ll i = max(1ll, l - 50); i <= min(n, r + 50); i++) ans = max(ans, ff(i));
      |                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bomb.cpp:9:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
bomb.cpp:106:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  106 |  for(ll i = max(1ll, l - 50); i <= min(n, r + 50); i++) ans = max(ans, ff(i));
      |                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from bomb.cpp:9:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
bomb.cpp:106:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
  106 |  for(ll i = max(1ll, l - 50); i <= min(n, r + 50); i++) ans = max(ans, ff(i));
      |                            ^