Submission #31188

# Submission time Handle Problem Language Result Execution time Memory
31188 2017-08-13T06:03:04 Z pasa3232 Boxes with souvenirs (IOI15_boxes) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include"boxes.h"
using namespace std;
typedef long long ll;

ll n, k, l, lef[10000010], right[10000010], ans;

ll delivery(int N, int K, int L, int data[]){
    n=N, k=K, l=L;
    for(ll i=1; i<=n; i++){
        lef[i]=min(l, (ll)data[i]*2);
        if(i>k) lef[i]+=lef[i-k];
    }
    for(ll i=n; i>0; i--){
        right[i]=min(l, (ll)(l-data[i])*2);
        right[i]+=right[i+k];
    }
    ans=min(lef[n], right[1]);
    for(ll i=1; i<n; i++) ans=min(ans, lef[i]+right[i+1]);
    return ans;
}

Compilation message

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:15:9: error: reference to 'right' is ambiguous
         right[i]=min(l, (ll)(l-data[i])*2);
         ^~~~~
boxes.cpp:6:28: note: candidates are: ll right [10000010]
 ll n, k, l, lef[10000010], right[10000010], ans;
                            ^~~~~
In file included from /usr/include/c++/7/ios:42:0,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from boxes.cpp:1:
/usr/include/c++/7/bits/ios_base.h:1007:3: note:                 std::ios_base& std::right(std::ios_base&)
   right(ios_base& __base)
   ^~~~~
boxes.cpp:16:9: error: reference to 'right' is ambiguous
         right[i]+=right[i+k];
         ^~~~~
boxes.cpp:6:28: note: candidates are: ll right [10000010]
 ll n, k, l, lef[10000010], right[10000010], ans;
                            ^~~~~
In file included from /usr/include/c++/7/ios:42:0,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from boxes.cpp:1:
/usr/include/c++/7/bits/ios_base.h:1007:3: note:                 std::ios_base& std::right(std::ios_base&)
   right(ios_base& __base)
   ^~~~~
boxes.cpp:16:19: error: reference to 'right' is ambiguous
         right[i]+=right[i+k];
                   ^~~~~
boxes.cpp:6:28: note: candidates are: ll right [10000010]
 ll n, k, l, lef[10000010], right[10000010], ans;
                            ^~~~~
In file included from /usr/include/c++/7/ios:42:0,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from boxes.cpp:1:
/usr/include/c++/7/bits/ios_base.h:1007:3: note:                 std::ios_base& std::right(std::ios_base&)
   right(ios_base& __base)
   ^~~~~
boxes.cpp:18:21: error: reference to 'right' is ambiguous
     ans=min(lef[n], right[1]);
                     ^~~~~
boxes.cpp:6:28: note: candidates are: ll right [10000010]
 ll n, k, l, lef[10000010], right[10000010], ans;
                            ^~~~~
In file included from /usr/include/c++/7/ios:42:0,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from boxes.cpp:1:
/usr/include/c++/7/bits/ios_base.h:1007:3: note:                 std::ios_base& std::right(std::ios_base&)
   right(ios_base& __base)
   ^~~~~
boxes.cpp:19:47: error: reference to 'right' is ambiguous
     for(ll i=1; i<n; i++) ans=min(ans, lef[i]+right[i+1]);
                                               ^~~~~
boxes.cpp:6:28: note: candidates are: ll right [10000010]
 ll n, k, l, lef[10000010], right[10000010], ans;
                            ^~~~~
In file included from /usr/include/c++/7/ios:42:0,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from boxes.cpp:1:
/usr/include/c++/7/bits/ios_base.h:1007:3: note:                 std::ios_base& std::right(std::ios_base&)
   right(ios_base& __base)
   ^~~~~