# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
874678 |
2023-11-17T15:44:13 Z |
aaron_dcoder |
Bob (COCI14_bob) |
C++17 |
|
1000 ms |
18044 KB |
#define NDEBUG
#ifdef NDEBUG
#define dbg(TXTMSG) if constexpr (false) cerr << "lol"
#define dbgv(VARN) ((void)0)
#define dbgfor(COND) if constexpr (false) for (COND)
#else
#define _GLIBCXX_DEBUG 1
#define _GLIBCXX_DEBUG_PEDANTIC 1
#pragma GCC optimize("trapv")
#define dbg(TXTMSG) cerr << "\n" << TXTMSG
#define dbgv(VARN) cerr << "\n" << #VARN << " = "<< VARN << ", line: " << __LINE__ << "\n"
#define dbgfor(COND) for (COND)
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
#define e0 first
#define e1 second
constexpr ll INFTY = 2e18;
ll numrects(ll b, ll e, vector<ll>& table) {
ll s = e-b+1;
ll o =0;
for (ll i = b; i <= e; ++i)
{
for (ll j = i; j <= e; ++j)
{
ll m=INFTY;
for (ll k = i; k <= j; ++k)
{
m = min(m, table[k]);
}
o+=m;
}
}
return o;
}
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll N,M;
cin >> N >> M;
vector<vector<ll>> H(N,vector<ll>(M,-1));
set<ll> posheights;
for (ll y = 0; y < N; ++y)
{
for (ll x = 0; x < M; ++x)
{
cin >> H[y][x];
}
}
ll outp=0;
vector<ll> uprun(M,1);
for (ll y = 0; y < N; ++y)
{
if (y!=0) {
for (ll x = 0; x < M; ++x)
{
if (H[y][x]==H[y-1][x]) {
uprun[x]++;
}
else {
uprun[x]=1;
}
}
}
ll runstart=0;
for (ll x = 1; x < M; ++x)
{
if (H[y][x]!=H[y][x-1]) {
outp+=numrects(runstart,x-1, uprun);
runstart=x;
}
}
outp+=numrects(runstart,M-1,uprun);
}
cout << outp;
}
Compilation message
bob.cpp: In function 'll numrects(ll, ll, std::vector<long long int>&)':
bob.cpp:27:5: warning: unused variable 's' [-Wunused-variable]
27 | ll s = e-b+1;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
71 ms |
2808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1032 ms |
3164 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
140 ms |
3576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
299 ms |
3420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
318 ms |
14980 KB |
Output is correct |
2 |
Execution timed out |
1018 ms |
10228 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
321 ms |
18044 KB |
Output is correct |
2 |
Execution timed out |
1028 ms |
10224 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1004 ms |
17748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1030 ms |
17748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |