Submission #1028053

#TimeUsernameProblemLanguageResultExecution timeMemory
1028053AbitoTrains (BOI24_trains)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
const int N=1e5+5,M=1e9+7,S=300;
int dp[N],d[N],x[N],n,s[S+5][S][400];
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n;
    for (int i=1;i<=n;i++) cin>>d[i]>>x[i];
    for (int i=n;i;i--){
        dp[i]=1;
        if (d[i]>S){
            for (int j=i+d[i];j<=n && j<=i+d[i]*x[i];j+=d[i]) dp[i]=(dp[i]+dp[j])%M;
        }
        elif (d[i] && x[i]){
            int l=i/d[i]+1,r=min(399,l+x[i]);
            //cout<<i<<' '<<l<<' '<<r<<endl;
            dp[i]=((s[d[i]][i%d[i]][l]-s[d[i]][i%d[i]][r]+M)%M+1)%M;
        }
        for (int j=1;j<=S;j++){
            s[j][i%j][i/j]=(s[j][i%j][i/j+1]+dp[i])%M;
        }
    }
    //for (int i=1;i<=n;i++) cout<<dp[i]<<' ';cout<<endl;
    cout<<dp[1]<<endl;
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:28:44: error: no matching function for call to 'min(int, long long int)'
   28 |             int l=i/d[i]+1,r=min(399,l+x[i]);
      |                                            ^
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 Main.cpp:1:
/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:
Main.cpp:28:44: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |             int l=i/d[i]+1,r=min(399,l+x[i]);
      |                                            ^
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 Main.cpp:1:
/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:
Main.cpp:28:44: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |             int l=i/d[i]+1,r=min(399,l+x[i]);
      |                                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/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:
Main.cpp:28:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |             int l=i/d[i]+1,r=min(399,l+x[i]);
      |                                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Main.cpp:1:
/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:
Main.cpp:28:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |             int l=i/d[i]+1,r=min(399,l+x[i]);
      |                                            ^