Submission #206816

#TimeUsernameProblemLanguageResultExecution timeMemory
206816vardan__02Detecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include <algorithm> #include <iostream> #include <fstream> #include <cstring> #include <string> #include <vector> #include <cstdio> #include <queue> #include <deque> #include <stack> #include <list> #include <set> #include <map> #include "molecules.h" using namespace std; vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int> ans; vector<pair<int,int> > a; int n = w.size(); for(int i = 0; i < n; ++i) a.PB(MP(w[i],i)); sort(a.begin(), a.end()); int left = 0, right = 0; long long tiv = 0; for(int i = 0; i < n; ++i) { while(i < n && tiv < l) { tiv += a[i].first; i++; } i--; if(tiv < l)return ans; if(tiv <= u) { if(u - l >= a[i].first - a[left].first) { for(int j = left; j <= i; ++j) ans.PB(a[j].second); sort(ans.begin(), ans.end()); return ans; } else { while(left <= i && u - l < a[i].first - a[left].first) { tiv -= a[left].first; left++; } right = i; } } else { while(left <= i && tiv > u) { tiv -= a[left].first; left++; } while(left <= i && u - l < a[i].first - a[left].first) { tiv -= a[left].first; left++; } right = i; } } tiv = 0; for(int i = left; i <= right; ++i) tiv += a[i].first; if(tiv >= l && tiv <= u && u - l >= a[right].first - a[left].first) { for(int j = left; j <= right; ++j) ans.PB(a[j].second); sort(ans.begin(), ans.end()); return ans; } else return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:22:11: error: 'class std::vector<std::pair<int, int> >' has no member named 'PB'
         a.PB(MP(w[i],i));
           ^~
molecules.cpp:22:14: error: 'MP' was not declared in this scope
         a.PB(MP(w[i],i));
              ^~
molecules.cpp:40:25: error: 'class std::vector<int>' has no member named 'PB'
                     ans.PB(a[j].second);
                         ^~
molecules.cpp:75:17: error: 'class std::vector<int>' has no member named 'PB'
             ans.PB(a[j].second);
                 ^~