# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
254548 | babo | Split the sequence (APIO14_sequence) | C++14 | 14 ms | 2688 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>
#define L long long
using namespace std;
L n,k;
L a[1000010],nu[1000010];
L cut[1000010];
bool ok(L now){
return cut[now]+1!=cut[now+1]&&
(nu[cut[now]]-nu[cut[now-1]])*(nu[cut[now+1]]-nu[cut[now]])
<(nu[cut[now]+1]-nu[cut[now-1]])*(nu[cut[now+1]]-nu[cut[now]+1]);
}
void dfs(L now){
if(now==k) return;
dfs(now+1);
while(ok(now))
{
cut[now]++;
dfs(now+1);
}
dfs(now+1);
}
int main()
{
scanf("%lld %lld",&n,&k);
k++;
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |