Submission #758708

#TimeUsernameProblemLanguageResultExecution timeMemory
758708Trisanu_DasBoat (APIO16_boat)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int mod=1e9+7; int dp[1005][505], inv[505], a[505], b[505], c[1005]; set<int> s; int f(int x, int y) { if (!y) return 1; int res=f(x, y/2); if (y&1) return res*res%mod*x%mod; else return res*res%mod; } signed main() { ios::sync_with_stdio(0); cin.tie(0); int n, m=0; cin >> n; for (int i=1; i<=n; i++) inv[i]=f(i, mod-2); for (int i=1; i<=n; i++) { cin >> a[i] >> b[i]; s.insert(a[i]); s.insert(b[i]+1); } for (auto itr=s.begin(); itr!=s.end(); itr++) [++m]=(*itr); for (int i=0; i<=n; i++) dp[0][i]=1; for (int i=1; i<m; i++) { for (int j=0; j<=n; j++) { dp[i][j]=dp[i-1][j]; int num=1, cnt=0; for (int k=1; k<=j; k++) { if (a[j-k+1]<=c[i] && c[i+1]-1<=b[j-k+1]) { cnt++; num=num*(c[i+1]-c[i]+cnt-1)%mod*inv[cnt]%mod; dp[i][j]=(dp[i][j]+dp[i-1][j-k]*num)%mod; } } } } cout << dp[m-1][n]-1; return 0; }

Compilation message (stderr)

boat.cpp: In function 'int main()':
boat.cpp:25:52: error: expected identifier before '++' token
   25 |     for (auto itr=s.begin(); itr!=s.end(); itr++) [++m]=(*itr);
      |                                                    ^~
boat.cpp: In lambda function:
boat.cpp:25:56: error: expected '{' before '=' token
   25 |     for (auto itr=s.begin(); itr!=s.end(); itr++) [++m]=(*itr);
      |                                                        ^
boat.cpp: In function 'int main()':
boat.cpp:25:62: error: no match for 'operator=' (operand types are 'main()::<lambda()>' and 'const long long int')
   25 |     for (auto itr=s.begin(); itr!=s.end(); itr++) [++m]=(*itr);
      |                                                              ^
boat.cpp:25:55: note: candidate: 'main()::<lambda()>& main()::<lambda()>::operator=(const main()::<lambda()>&)' (deleted)
   25 |     for (auto itr=s.begin(); itr!=s.end(); itr++) [++m]=(*itr);
      |                                                       ^
boat.cpp:25:55: note:   no known conversion for argument 1 from 'const long long int' to 'const main()::<lambda()>&'