Submission #873952

#TimeUsernameProblemLanguageResultExecution timeMemory
873952cocoheartsBank (IZhO14_bank)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <iostream> using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<int> vi; // #define INF 2000000000 // #define MOD 1000000007 #define loop(x,n) for(int x = 0; x < n; ++x) // #define iloop(x,a,n) for(int x=a; x<n; ++x) // #define sloop(e,s) for(auto&& e : s) // #define itloop(it,m) for(auto&& it = m.begin(); it!=m.end(); ++it) // #define F first // #define S second // #define PB push_back // #define MP make_pair ii DP[1<<20]; int main() { // freopen("input","r",stdin); ios::sync_with_stdio(false); cin.tie(nullptr); int N,W; cin >> N >> W; int weights[N]; loop(i,N) { cin >> weights[i]; } loop(bm,1<<N) { if (!bm) { DP[bm] = MP(1,0); continue; } ii ans = MP(INT_MAX,0); loop(ind,N) { if (bm&1<<ind) { int last = DP[bm^1<<ind].S+weights[ind]; int rides = DP[bm^1<<ind].F; if (last>W) { last = weights[ind]; ++rides; } if (rides < ans.F) { ans.F=rides; ans.S=last; } else if (rides==ans.F) { ans.S = min(ans.S,last); } } } DP[bm] = ans; } cout << DP[(1<<N)-1].F; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:37:22: error: 'MP' was not declared in this scope; did you mean 'DP'?
   37 |             DP[bm] = MP(1,0);
      |                      ^~
      |                      DP
bank.cpp:40:18: error: 'MP' was not declared in this scope; did you mean 'DP'?
   40 |         ii ans = MP(INT_MAX,0);
      |                  ^~
      |                  DP
bank.cpp:43:42: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'S'
   43 |                 int last = DP[bm^1<<ind].S+weights[ind];
      |                                          ^
bank.cpp:44:43: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'F'
   44 |                 int rides = DP[bm^1<<ind].F;
      |                                           ^
bank.cpp:49:33: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'F'
   49 |                 if (rides < ans.F) {
      |                                 ^
bank.cpp:50:25: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'F'
   50 |                     ans.F=rides; ans.S=last;
      |                         ^
bank.cpp:50:38: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'S'
   50 |                     ans.F=rides; ans.S=last;
      |                                      ^
bank.cpp:51:39: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'F'
   51 |                 } else if (rides==ans.F) {
      |                                       ^
bank.cpp:52:25: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'S'
   52 |                     ans.S = min(ans.S,last);
      |                         ^
bank.cpp:52:37: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'S'
   52 |                     ans.S = min(ans.S,last);
      |                                     ^
bank.cpp:58:26: error: 'ii' {aka 'struct std::pair<int, int>'} has no member named 'F'
   58 |     cout << DP[(1<<N)-1].F;
      |                          ^