Submission #925404

#TimeUsernameProblemLanguageResultExecution timeMemory
925404vjudge1Bob (COCI14_bob)C++14
120 / 120
567 ms25800 KiB
#include <bits/stdc++.h> #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define fo(a,b) for (int i(a);i<=b;i++) #define fo1(a,b) for (int j(a);j<=b;j++) #define fod(a,b) for (int i(a);i>=b;i--) #define ll long long using namespace std; ll n,m; ll arraya[1002][1002]; ll arrayb[1002][1002]; int main(){ fast; cin>>n>>m; fo (1,n){ fo1(1,m){ cin>>arraya[i][j]; } } fo (1,n){ fo1(1,m){ if (arraya[i][j]==arraya[i-1][j]){ arrayb[i][j]=arrayb[i-1][j]+1; } else{ arrayb[i][j]=1; } } } ll soluong=0; fo (1,n){ fo1(1,m){ ll l=j; ll minn=arrayb[i][j]; while (l<=m&&arraya[i][l]==arraya[i][j]){ minn=min(arrayb[i][l],minn); soluong+=minn; l++; } } } cout<<soluong; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...