Submission #101278

#TimeUsernameProblemLanguageResultExecution timeMemory
101278chunghanDetecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include"molecules.h" using namespace std; typedef long long int lld; typedef pair<int, int> pii; vector<int> solve(int l, int u, vector<int> w) { vector<pii> p; vector<int> rst; lld S[200001]; int r1, r2; for (int i = 0; i < (int)w.size(); i++) p.push_back(pii(w[i], i)); sort(p.begin(), p.end()); S[0] = p[0].first; for (int i = 1; i < (int)p.size(); i++) S[i] = S[i-1] + p[i].first; for (int i = 1; i < (int)p.size(); i++) { lld t = S[i] - u; int j = lower_bound(S, S + (lld*)p.size(), t); j--; if (S[i] - S[j] >= l) { r1 = j; r2 = i; break; } } for (int i = r1; i <= r2; i++) rst.push_back(p[i].second); return rst; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> solve(int, int, std::vector<int>)':
molecules.cpp:22:34: error: invalid operands of types 'lld [200001] {aka long long int [200001]}' and 'lld* {aka long long int*}' to binary 'operator+'
         int j = lower_bound(S, S + (lld*)p.size(), t);
                                ~~^~~~~~~~~~~~~~~~