QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#692774 | #9528. New Energy Vehicle | xuxuxuxuxu# | Compile Error | / | / | C++14 | 1.3kb | 2024-10-31 15:01:23 | 2024-10-31 15:01:28 |
Judging History
This is the latest submission verdict.
- [2024-10-31 15:01:28]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-10-31 15:01:23]
- Submitted
answer
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <set>
using std::cin;
using std::cout;
using i64 = long long;
using pii = std::pair<int, int>;
const int nx = 1e5;
int tc;
int n;
int a[nx + 5], b[nx + 5];
int m;
int x[nx + 5], t[nx + 5];
int pv[nx + 5];
std::vector<int> v[nx + 5];
std::set<pii> st;
int main() {
std::ios::sync_with_stdio(false);
cin >> tc;
while (tc--) {
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
v[i].clear();
pv[i] = 0;
}
for (int i = 1; i <= m; ++i) {
cin >> x[i] >> t[i];
}
i64 res = 0, sum = 0, ans = 0;
for (int i = 1; i <= n; ++i) sum += a[i], b[i] = a[i];
for (int i = 1; i <= m; ++i) {
res += x[i] - x[i - 1];
if (sum >= res) {
if (b[t[i]] >= res) sum = sum - b[t[i]] + a[t[i]], b[t[i]] = a[t[i]], res = 0;
else sum = sum - b[t[i]] + a[t[i]], res -= b[t[i]], b[t[i]] = a[t[i]];
}else {
ans = x[i - 1] + sum - (res - x[i] + x[i - 1]);
break;
}
}
if (ans == 0) ans = x[m] + sum - res;
cout << ans << '\n';
}
return 0;
}
Details
answer.code:23:6: error: ‘vector’ in namespace ‘std’ does not name a template type 23 | std::vector<int> v[nx + 5]; | ^~~~~~ answer.code:6:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 5 | #include <set> +++ |+#include <vector> 6 | answer.code: In function ‘int main()’: answer.code:35:13: error: ‘v’ was not declared in this scope 35 | v[i].clear(); | ^