Submission #1128747

#TimeUsernameProblemLanguageResultExecution timeMemory
1128747nurkeyevvSimple game (IZhO17_game)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back using namespace std; const int N = 2550; const int M = 100; const int mod1 = 998244353; const int mod = 998244353; const int inf = 1e18; char a[M][M]; void porsсhe(){ int n,m; cin >> n >> m; for(int i = 1;i <= n;i++){ for(int j = 1;j <= m;j++){ cin >> a[i][j]; } } int cnt = 0,mn = inf,mn1 = inf; for(int i = 1;i <= n;i++){ cnt = 0; for(int j = 1;j <= m;j++){ if(a[i][j] == '1'){ cnt++; } else if(cnt >= 1){ mn = min(mn,cnt); cnt = 0; } } } for(int j = 1;j <= m;j++){ int ans = 0; for(int i = 1;i <= n;i++){ if(a[i][j] == '1'){ ans++; } else if(ans >= 1){ mn1 = min(ans,mn1); ans = 0; } } } // if(mn == 0 && mn1 == 0){ // cout << 0 << '\n'; // return; // } // else if(mn != 0 && mn1 != 0){ // cout << max(mn,mn1); // return; // } cout << mn * mn1 << '\n'; // 3 3 // 1 1 // 3 3 // 4 4 // 1 1 // 3 3 // 0 0 // 3 3 // 2 2 } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; //cin >> tt; for(int i = 1;i <= tt;i++){ porsсhe(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...