Submission #135017

#TimeUsernameProblemLanguageResultExecution timeMemory
135017wilwxkSplit the sequence (APIO14_sequence)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN=1e5+5; const ll INF=1e18; ll dp[MAXN][205]; int opt[MAXN][205]; ll soma[MAXN]; ll v[MAXN]; int n, x; struct reta { ll a, b, id; }; vector<reta> st[300]; void init() { dp[0][0]=0; for(int i=1; i<=x; i++) dp[0][i]=-INF; for(int i=1; i<=n; i++) dp[i][0]=-INF; } int cmp(reta a, reta b, reta c) { double aa=(a.b-b.b); aa/=(b.a-a.a); double bb=(c.b-b.b); aa/=(b.a-c.a); if(aa==bb) return 0; if(aa<bb) return 1; return -1; } void update(int ind, int k) { } ll query(ll val) { } int main() { scanf("%d %d", &n, &x); x++; for(int i=1; i<=n; i++) scanf("%lld", &v[i]); for(int i=1; i<=n; i++) soma[i]=soma[i-1], soma[i]+=v[i]; init(); for(int i=1; i<=n; i++) { for(int j=1; j<=x; j++) { auto cur=query(soma[i], j-1); dp[i][j]=; opt[i][j]=; update(i, j); // printf("%d %d >> %lld // %d\n", i, j, dp[i][j], opt[i][j]); } } printf("%lld\n", dp[n][x]); vector<int> respf; int ind=n; int k=x; while(respf.size()<x-1) { respf.push_back(opt[ind][k]); ind=opt[ind][k--]; } reverse(respf.begin(), respf.end()); for(auto cur : respf) printf("%d ", cur); }

Compilation message (stderr)

sequence.cpp: In function 'll query(ll)':
sequence.cpp:37:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
sequence.cpp: In function 'int main()':
sequence.cpp:47:31: error: too many arguments to function 'll query(ll)'
    auto cur=query(soma[i], j-1);
                               ^
sequence.cpp:35:4: note: declared here
 ll query(ll val) {
    ^~~~~
sequence.cpp:49:13: error: expected primary-expression before ';' token
    dp[i][j]=;
             ^
sequence.cpp:50:14: error: expected primary-expression before ';' token
    opt[i][j]=;
              ^
sequence.cpp:47:9: warning: unused variable 'cur' [-Wunused-variable]
    auto cur=query(soma[i], j-1);
         ^~~
sequence.cpp:60:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(respf.size()<x-1) {
        ~~~~~~~~~~~~^~~~
sequence.cpp:40:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &x); x++;
  ~~~~~^~~~~~~~~~~~~~~~~
sequence.cpp:41:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=n; i++) scanf("%lld", &v[i]);
                          ~~~~~^~~~~~~~~~~~~~~