# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
110831 |
2019-05-12T11:01:47 Z |
hugo_pm |
Bob (COCI14_bob) |
C++17 |
|
152 ms |
5528 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define form2(i, a, b) for (int i = (a); i < (b); ++i)
#define ford2(i, a, b) for (int i = (a-1); i >= (b); --i)
#define form(i, n) form2(i, 0, n)
#define ford(i, n) ford2(i, n, 0)
#define chmax(x, v) x = max(x, (v))
#define chmin(x, v) x = min(x, (v))
#define fi first
#define se second
const long long BIG = 1000000000000000000LL;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
void solve();
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
solve();
return 0;
}
const int borne = 505;
int tab[borne][borne];
int rel[borne][borne]; // rel on lig
int nbLig, nbCol;
void solve()
{
cin >> nbLig >> nbCol;
assert(nbLig <= 500 && nbCol <= 500);
form(lig, nbLig) {
form(col, nbCol) {
cin >> tab[lig][col];
if (col > 0) {
rel[lig][col] = rel[lig][col-1];
if (tab[lig][col] != tab[lig][col-1]) ++rel[lig][col];
}
}
}
int rep = 0;
form(ligDeb, nbLig) form(colDeb, nbCol) {
int sousRep = 0;
int colFin = nbCol-1;
form2(ligFin, ligDeb, nbLig) {
if (tab[ligFin][colDeb] != tab[ligDeb][colDeb]) break;
while (colFin >= colDeb && rel[ligFin][colFin] != rel[ligFin][colDeb]) --colFin;
if (colFin < colDeb) break;
sousRep += (colFin-colDeb+1);
}
rep += sousRep;
}
cout << rep << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
4924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
152 ms |
5300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
5500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
125 ms |
5528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |