Submission #925404

# Submission time Handle Problem Language Result Execution time Memory
925404 2024-02-11T14:43:08 Z vjudge1 Bob (COCI14_bob) C++14
120 / 120
567 ms 25800 KB
#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 time Memory Grader output
1 Correct 1 ms 4568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 11352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 11856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 12060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 12068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 22612 KB Output is correct
2 Correct 503 ms 18000 KB Output is correct
3 Correct 557 ms 18000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 111 ms 25800 KB Output is correct
2 Correct 234 ms 18100 KB Output is correct
3 Correct 559 ms 18004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 152 ms 25540 KB Output is correct
2 Correct 551 ms 18000 KB Output is correct
3 Correct 556 ms 18324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 115 ms 25724 KB Output is correct
2 Correct 541 ms 18004 KB Output is correct
3 Correct 567 ms 18240 KB Output is correct