Submission #1128763

#TimeUsernameProblemLanguageResultExecution timeMemory
1128763raiselBomb (IZhO17_bomb)C++20
0 / 100
71 ms7656 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC target("avx2") #define forn for(int i=1;i<=n;i++) #define Yes cout<<"YES\n" #define No cout<<"NO\n" #define YES cout<<"YES\n" #define NO cout<<"NO\n" #define pb push_back #define sp setprecision #define int long long #define ll long long #define nn '\n' using namespace std; const int N=2502; const int MOD=1e9+7; char a[N][N]; string ab="abcdefghijklmnopqrstuvwxyz"; int binpow(int n, int k) { int ans = 1; while (k > 0) { if (k % 2 == 1) { ans = (ans * n) % MOD; } n = (n * n) % MOD; k /= 2; } return ans; } int n,m; string s; void al(){ cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>a[i][j]; } } int cnt=0; vector<int>v; if(n==1) m++; if(m==1) n++; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(a[i][j]=='1') cnt++; else { if(cnt>0) v.pb(cnt); cnt=0; } } } int x=v[0]; for(auto i:v){ int g=__gcd(x,i); x=g; } cout<<x; } signed main(){ // freopen("bomb.in","r",stdin); // freopen("bomb.out","w",stdout); ios_base::sync_with_stdio(false); cin.tie(nullptr); int t=1; // cin>>t; while(t--) { al(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...