# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1115035 |
2024-11-19T23:01:28 Z |
AdamGS |
Fire (JOI20_ho_t5) |
C++17 |
|
1000 ms |
22832 KB |
#include<bits/stdc++.h>
using namespace std;
int main() {
int n, q, t, l, p, s;
cin >> n >> q;
vector<int> dis;
vector<vector<int>> fakty;
vector<vector<pair<int, int>>> zap(n);
vector<int> dod;
for (int i = 0; i < n; i++) {
cin >> s;
dis.push_back(s);
}
for (int i = 0; i < q; i++) {
cin >> t >> l >> p;
zap[t - 1].push_back({l, p});
fakty.push_back({t, l, p});
}
map<vector<int>, int> wyniki;
for (int i = 0; i < n; i++) {
for (int j = n - 1; j > 0; j--) {
if (dis[j - 1] > dis[j]) {
dis[j] = dis[j - 1];
}
}
for (pair<int, int> z : zap[i]) {
long long s = 0;
for(int y = z.first; y <= z.second; y++) {
s += dis[y - 1];
}
wyniki[{i + 1, z.first, z.second}] = s;
//cout << i + 1 << " " << z.first << " " << z.second << endl;
}
}
for(vector<int> i : fakty) {
//cout << i[0] << " " << i[1] << " " << i[2] << endl;
cout << wyniki[i] << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Execution timed out |
1075 ms |
19784 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Execution timed out |
1075 ms |
22832 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1066 ms |
22440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |