# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523340 | andrei_boaca | Bigger segments (IZhO19_segments) | C++17 | 224 ms | 20788 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
struct date
{
ll maxseg,maxprev;
} dp[500005];
ll v[500005],s[500005];
void update(int a,int b)
{
if(dp[a].maxseg<dp[b].maxseg)
dp[a]=dp[b];
else if(dp[a].maxseg==dp[b].maxseg&&dp[a].maxprev<dp[b].maxprev)
dp[a]=dp[b];
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>v[i];
s[i]=s[i-1]+v[i];
}
dp[1].maxseg=1;
dp[1].maxprev=1;
for(int i=1;i<=n;i++)
{
update(i,i-1);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |