# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
316045 |
2020-10-25T01:55:06 Z |
FlashGamezzz |
Bob (COCI14_bob) |
C++17 |
|
138 ms |
21752 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 (grid[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 |
23 ms |
6776 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
7160 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
7424 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
7416 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
114 ms |
18664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
129 ms |
21752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
138 ms |
21716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
132 ms |
21752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |