# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
316046 |
2020-10-25T01:58:18 Z |
FlashGamezzz |
Bob (COCI14_bob) |
C++17 |
|
133 ms |
12536 KB |
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
using namespace std;
int n, m, grid[1000][1000];
long long dp[1000][1000];
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> m;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
cin >> grid[i][j];
}
}
dp[0][0] = 1;
for (int i = 1; i < n; i++){
dp[i][0] = 1;
if (grid[i-1][0] == grid[i][0]){
dp[i][0] += dp[i-1][0];
}
}
for (int i = 1; i < m; i++){
dp[0][i] = 1;
if (grid[0][i-1] == grid[0][i]){
dp[0][i] += dp[0][i-1];
}
}
for (int i = 1; i < n; i++){
for (int j = 1; j < m; j++){
dp[i][j] = 1;
if (grid[i-1][j] == grid[i][j]){
dp[i][j] += dp[i-1][j];
}
if (grid[i][j-1] == grid[i][j]){
dp[i][j] += dp[i][j-1];
}
if (dp[i][j] > 1 && grid[i-1][j-1] == grid[i][j]){
dp[i][j] -= dp[i-1][j-1];
}
}
}
long long ans = 0;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
//cout << dp[i][j] << " ";
ans += dp[i][j];
}
//cout << endl;
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
768 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
768 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
6264 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
6272 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
6272 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
6144 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
116 ms |
12032 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
132 ms |
12024 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
133 ms |
12024 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
133 ms |
12536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |