제출 #857917

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
8579172023-10-07 07:17:31nammm수열 (APIO14_sequence)C++14
0 / 100
17 ms4700 KiB
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define f first
#define s second
#define pll pair<ll,ll>
#define vi vector<int>
using namespace std;
const int N=1e5+5;
int par[1201][N]{0};
ll d1[N]{0},d2[N]{0};
ll a[N]{0};
int n;
int cur=1;
void solve(int l,int r,int opl,int opr){
int m=(l+r)>>1;
pll t = {0,0};
for(int i=opl;i<=min(opr,m-1);i++){
t=max(t,{d1[i]+(a[m]-a[i])*(a[n]-a[m]),i});
}
par[cur][m]=t.s;
d2[m]=t.f;
if(l>=r)return;
solve(l,m-1,opl,t.s),solve(m+1,r,t.s,opr);
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
int k;cin>>n>>k;
for(int i=1;i<=n;i++)cin>>a[i],a[i]+=a[i-1];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

sequence.cpp: In function 'int main()':
sequence.cpp:45:25: warning: 'mem' may be used uninitialized in this function [-Wmaybe-uninitialized]
   45 |         mem=par[cur][mem];
      |             ~~~~~~~~~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...