QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#825745 | #9222. Price Combo | hhoppitree | Compile Error | / | / | C++17 | 1.1kb | 2024-12-21 22:24:23 | 2024-12-21 22:24:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
pair<int, int> a[N];
long long b[N];
struct Info {
long long sb[2], mn;
} p[1 << 19];
Info operator + (Info x, Info y) {
Info res;
res.sb = x.sb + y.sb;
res.mn = min(x.mn, y.mn);
return res;
}
void build(int k, int l, int r) {
if (l == r) {
p[k].sb[0] = b[l], p[k].mn = 1e18;
return;
}
int mid = (l + r) >> 1;
build(k << 1, l, mid), build(k << 1 | 1, mid + 1, r);
}
signed main() {
int n; scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%d", &a[i].first);
for (int i = 1; i <= n; ++i) scanf("%d", &a[i].second);
vector<int> lsh = {0, 2e9};
for (int i = 1; i <= n; ++i) lsh.push_back(a[i].second);
sort(lsh.begin(), lsh.end()), lsh.erase(unique(lsh.begin(), lsh.end()), lsh.end());
auto getId = [&](int x) {
return lower_bound(lsh.begin(), lsh.end(), x) - lsh.begin() + 1;
};
for (int i = 1; i <= n; ++i) b[getId(a[i].second)] += a[i].second;
build(1, 1, lsh.size());
sort(a, a + n + 1);
for (int i = n; ~i; --i) {
}
return 0;
}
Details
answer.code: In function ‘Info operator+(Info, Info)’: answer.code:16:19: error: invalid operands of types ‘long long int [2]’ and ‘long long int [2]’ to binary ‘operator+’ 16 | res.sb = x.sb + y.sb; | ~~~~ ^ ~~~~ | | | | | long long int [2] | long long int [2] answer.code: In function ‘int main()’: answer.code:34:30: error: narrowing conversion of ‘2.0e+9’ from ‘double’ to ‘int’ [-Wnarrowing] 34 | vector<int> lsh = {0, 2e9}; | ^ answer.code:31:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 31 | int n; scanf("%d", &n); | ~~~~~^~~~~~~~~~ answer.code:32:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 32 | for (int i = 1; i <= n; ++i) scanf("%d", &a[i].first); | ~~~~~^~~~~~~~~~~~~~~~~~~ answer.code:33:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | for (int i = 1; i <= n; ++i) scanf("%d", &a[i].second); | ~~~~~^~~~~~~~~~~~~~~~~~~~