# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103746 | 2019-04-02T12:04:21 Z | MohamedAhmed0 | Bob (COCI14_bob) | C++14 | 1000 ms | 17900 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n , m ; scanf("%d %d" , &n , &m) ; int arr[n][m] , last[n][m]; for(int i = 0 ; i < n ; ++i) { for(int j = 0 ; j < m ; ++j) scanf("%d" , &arr[i][j]) ; } for(int i = 0 ; i < n ; ++i) { last[i][m-1] = m-1 ; for(int j = m-2 ; j >= 0 ; --j) { if(arr[i][j] == arr[i][j+1]) last[i][j] = last[i][j+1] ; else last[i][j] = j ; } } long long ans = 0ll ; for(int i = 0 ; i < n ; ++i) { for(int j = 0 ; j < m ; ++j) { long long MIN = 1e9 ; for(int k = i ; k >= 0 ; --k) { if(arr[i][j] != arr[k][j]) break; MIN = min(MIN , last[k][j] - j + 1ll) ; ans += (MIN*1ll) ; } } } return cout<<ans<<"\n" , 0 ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 44 ms | 2908 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 75 ms | 3320 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 44 ms | 3488 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 3512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 193 ms | 14984 KB | Output is correct |
2 | Execution timed out | 1077 ms | 10104 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 223 ms | 17832 KB | Output is correct |
2 | Execution timed out | 1010 ms | 10232 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 338 ms | 17900 KB | Output is correct |
2 | Execution timed out | 1046 ms | 10132 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 308 ms | 17784 KB | Output is correct |
2 | Execution timed out | 1073 ms | 10104 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |