Submission #253291

#TimeUsernameProblemLanguageResultExecution timeMemory
253291HeheheDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //:3 using namespace std; typedef long long ll; #define all(a) (a).begin(), (a).end() #define ff first #define ss second #define pb push_back #define mp make_pair #define rc(s) return cout<<s,0 #define pi pair <int, int> #define sz(x) (int)((x).size()) #include "molecules.h" const int dx[] = {0, 1, 0, -1}; const int dy[] = {1, 0, -1, 0}; const ll inf = 2e9; const ll mod = 1e9 + 7; const int H = 1e6 + 11; const ll INF64 = 3e18 + 1; const double eps = 1e-14; const double PI = acos(-1); //ifstream in(".in"); //ofstream out(".out"); vector<pi>v; vector<int> add(int l, int r){ vector<int>ans; if(l > r)return ans; for(int i = l; i <= r; i++){ ans.push_back(v[i].ss); } return ans; } vector<int> find_subset(int l, int u, vector<int> w) { int n = sz(w); v.clear(); for(int i = 0; i < n; i++){ v.push_back({w[i], i}); } sort(all(v)); int L = 0, cur = v[0].ff; if(cur >= l && cur <= u)return add(0, 0); for(int i = 1; i < n; i++){ cur += v[i].ff; while(cur > u && L < i){ cur -= v[L]; L++; } if(cur >= l && cur <= u)return add(L, i); } return add(1, 0); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:62:17: error: no match for 'operator-=' (operand types are 'int' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}')
             cur -= v[L];