Submission #1052492

#TimeUsernameProblemLanguageResultExecution timeMemory
1052492modwwe선물상자 (IOI15_boxes)C++17
Compilation error
0 ms0 KiB
//https://www.instagram.com/_modwwe/
//#pragma GCC optimize("Ofast,unroll-loops")
#include "boxes.h"
#include<bits/stdc++.h>
#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP     ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe  int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".ans","w",stdout)
#define pb push_back
#define checktime   cerr << (double)clock() / CLOCKS_PER_SEC * 1000  << " ms";
using namespace std;
void phongbeo();
const ll inf=1e18;
const int mod2=1e9+7;
const int  mod1=998244353;
struct icd
{
    long double a;
    int b;
};
struct ib
{
    ll a;
    ll b;
};
struct ic
{
    int a,b,c;
};
struct id
{
    int a,b,c,d;
};
struct ie
{
    int a,b,c,d,e;

};

ll n,m,s1,s2,s4,s3,sf,k,s5,s6,mx,s7,s8,s9,mx2,res,dem2=0,dem=0,s33,dem3,l,r,mid;
int  i,s10,s12;
int kk;
int el=29;


int a[10000002];
ll dp[10000002];
ll dp2[10000002];
long long delivery(int N, int K, int L, int p[])
{
n=N;
k=K;
 m=L;
    for(int i=1; i<=N; i++)
    {
        a[++dem]=p[i];
     if(a[dem]==0) dem--,n--;
    }
 for(int i=1;i<=n;i++)
 {
     dp[i]=dp[max(i-k,0ll)]+min(m,a[i]*2);
 }
 s2=0;
  for(int i=n;i>=1;--i)
      dp2[i]=dp2[min(i+k,n+1)]+min((m-a[i])*2,m);
   s4=inf;
   for(int i=0;i<=n;i++)
     s4=min(s4,dp[i]+dp2[i+1]);
     cout<<s4;
}

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:60:13: warning: declaration of 'i' shadows a global declaration [-Wshadow]
   60 |     for(int i=1; i<=N; i++)
      |             ^
boxes.cpp:47:6: note: shadowed declaration is here
   47 | int  i,s10,s12;
      |      ^
boxes.cpp:65:10: warning: declaration of 'i' shadows a global declaration [-Wshadow]
   65 |  for(int i=1;i<=n;i++)
      |          ^
boxes.cpp:47:6: note: shadowed declaration is here
   47 | int  i,s10,s12;
      |      ^
boxes.cpp:67:41: error: no matching function for call to 'min(long long int&, int)'
   67 |      dp[i]=dp[max(i-k,0ll)]+min(m,a[i]*2);
      |                                         ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from boxes.cpp:4:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
boxes.cpp:67:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   67 |      dp[i]=dp[max(i-k,0ll)]+min(m,a[i]*2);
      |                                         ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from boxes.cpp:4:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
boxes.cpp:67:41: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   67 |      dp[i]=dp[max(i-k,0ll)]+min(m,a[i]*2);
      |                                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
boxes.cpp:67:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   67 |      dp[i]=dp[max(i-k,0ll)]+min(m,a[i]*2);
      |                                         ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from boxes.cpp:4:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
boxes.cpp:67:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   67 |      dp[i]=dp[max(i-k,0ll)]+min(m,a[i]*2);
      |                                         ^
boxes.cpp:70:11: warning: declaration of 'i' shadows a global declaration [-Wshadow]
   70 |   for(int i=n;i>=1;--i)
      |           ^
boxes.cpp:47:6: note: shadowed declaration is here
   47 | int  i,s10,s12;
      |      ^
boxes.cpp:70:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   70 |   for(int i=n;i>=1;--i)
      |             ^
boxes.cpp:73:12: warning: declaration of 'i' shadows a global declaration [-Wshadow]
   73 |    for(int i=0;i<=n;i++)
      |            ^
boxes.cpp:47:6: note: shadowed declaration is here
   47 | int  i,s10,s12;
      |      ^
boxes.cpp:73:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   73 |    for(int i=0;i<=n;i++)
      |    ^~~
boxes.cpp:75:6: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   75 |      cout<<s4;
      |      ^~~~
boxes.cpp:76:1: warning: no return statement in function returning non-void [-Wreturn-type]
   76 | }
      | ^