Submission #1226970

#TimeUsernameProblemLanguageResultExecution timeMemory
1226970cpdreamerBoat (APIO16_boat)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; const long long INF = 1e17; typedef long long ll; const ll MOD = 1e9+7; #define F first #define pb push_back #define S second #define P pair #define V vector #define all(v) v.begin(), v.end() typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_multiset; void file() { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); } ll add(ll a,ll b) { return ((a%MOD)+b(%MOD))%MOD; } void solve() { int n; cin>>n; ll A[n]; ll B[n]; for (int i=0;i<n;i++) { cin>>A[i]>>B[i]; } ll dp[n]; dp[0]=1LL; ll ans=1; for (int i=1;i<n;i++) { dp[i]=1; for (int j=i-1;j>=0;j--) { if (A[j]<A[i]) { dp[i]=add(dp[i],dp[j]); } } ans=add(ans,dp[i]); } cout<<ans<<endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); //file(); solve(); }

Compilation message (stderr)

boat.cpp: In function 'll add(ll, ll)':
boat.cpp:20:23: error: expected primary-expression before '%' token
   20 |     return ((a%MOD)+b(%MOD))%MOD;
      |                       ^
boat.cpp:20:27: error: 'b' cannot be used as a function
   20 |     return ((a%MOD)+b(%MOD))%MOD;
      |                           ^
boat.cpp: In function 'void file()':
boat.cpp:16:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     freopen("input.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
boat.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     freopen("output.txt","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~