QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325692 | #8229. 栈 | yzy1 | 0 | 12ms | 6776kb | C++17 | 1.9kb | 2024-02-11 20:06:11 | 2024-02-11 20:06:11 |
Judging History
answer
// baoli
#include <bits/stdc++.h>
#if defined(LOCAL)
#define DBG_MACRO_NO_WARNING
#include <dbg.hpp>
#else
#define dbg(x...) (0)
#endif
using namespace std;
using ll = long long;
// #define int ll
#define rep(i, f, t) for (int i = (f), ed##i = (t); i <= ed##i; ++i)
#define re(i, t) rep (i, 1, t)
#define per(i, t, f) for (int i = (t), ed##i = (f); i >= ed##i; --i)
#define ste(i, f, t, s) for (int i = (f), ed##i = (t); i <= ed##i; i += s)
#define nxt(i, f, g) for (int i = g.h[f]; i; i = g.e[i].n)
#define umod(x) ((x) >= mo && ((x) -= mo))
#define dmod(x) ((x) < 0 && ((x) += mo))
#define y1 y1__
#define fio(x) (freopen(x ".in", "r", stdin), freopen(x ".out", "w", stdout))
template <class T, class E>
__attribute__((always_inline)) inline void up(T &x, E &&y) {
if (x < y) x = y;
}
template <class T, class E>
__attribute__((always_inline)) inline void down(T &x, E &&y) {
if (y < x) x = y;
}
const int N = 1e5 + 9;
int n, m;
vector<pair<int, int>> sta[N];
inline void Pop(int p, ll x) {
while (x && sta[p].size()) {
if (sta[p].back().first <= x)
x -= sta[p].back().first, sta[p].pop_back();
else
sta[p].back().first -= x, x = 0;
}
}
inline ll Ask(int p, ll l, ll r) {
--l;
ll sum = 0, ans = 0;
for (auto [cnt, val] : sta[p]) {
ans += 1ll * val * max(0ll, (min(r, sum + cnt) - max(l, sum)));
}
return ans;
}
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n >> m;
while (m--) {
int op;
cin >> op;
if (op == 1) {
int l, r, x, y;
cin >> l >> r >> x >> y;
rep (i, l, r) sta[i].push_back({x, y});
} else if (op == 2) {
int l, r;
ll x;
cin >> l >> r >> x;
rep (i, l, r) Pop(i, x);
} else if (op == 3) {
int p;
ll l, r;
cin >> p >> l >> r;
cout << Ask(p, l, r) << '\n';
}
}
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 12ms
memory: 6776kb
input:
4907 4910 2 763 3330 1 3 307 1 1 1 2262 3430 22699 89397 1 1915 4000 51541 67587 2 212 2990 9763 2 1086 2162 1 2 1813 4496 16760 1 51 2796 68005 99390 1 1267 1519 74236 66178 3 1768 23808 54314 2 900 4122 27758 3 3287 17350 28989 2 3277 4024 3633 2 444 4866 1 2 353 4219 1061 1 987 3141 99906 17320 2...
output:
0 3032090730 478273950 859096795 200648623 98486697 691214382 123945 0 61782451 0 0 0 762429740 0 638060258 0 3504698464 0 0 6024704458 2625373140 961035066 0 3832874176 53899549 0 0 451585320 0 515151640 84280112 0 4707150236 1269900438 3724578987 0 0 4109884860 642842550 1027888122 113773506 59115...
result:
wrong answer 3rd numbers differ - expected: '903396180', found: '478273950'
Subtask #2:
score: 0
Time Limit Exceeded
Test #6:
score: 0
Time Limit Exceeded
input:
99999 99998 1 5026 18575 27178 90423 3 30623 1 1 3 76936 1 1 1 77021 95683 84664 24734 1 46085 74886 40512 11266 3 5048 8594 22468 1 53318 77721 97151 70784 1 70645 91192 37556 13013 1 56752 56940 91812 62887 1 7928 34576 87339 69404 3 74875 32807 100970 3 22338 17221 25771 3 21421 20602 57957 3 717...
output:
0 0 1254619125 4703224026 593473604 2592655824 1143798656 5629679917 110091352 1226646296 1989326852 1002183182 0 0 0 0 1790873593 5187399319 0 0 42868467293 899316516 0 6411326682 0 20615360837 3215147936 6840597923 13597117610 0 456207732 0 42991458601 0 0 948784563 23357328942 0 9499520539 0 0 0 ...
result:
Subtask #3:
score: 0
Time Limit Exceeded
Test #12:
score: 0
Time Limit Exceeded
input:
100000 99993 1 47773 70467 16065 1 2 52349 78446 2304 3 40821 1 1 1 40216 93069 78144 1 1 41089 43671 76025 1 2 35263 68629 31066 3 79881 13534 57327 3 5556 1 1 2 21962 38192 1 1 664 58116 9417 1 3 28089 6039 7989 2 88500 90302 9946 3 63215 49410 60770 2 11069 89527 57581 2 70303 97603 12363 1 3420 ...
output:
0 43794 0 1951 0 129 898 29245 13099 0 0 0 0 203422 58193 23594 0 0 32225 37527 0 0 9126 92701 33006 191372 85272 1602 106548 66260 4068 0 15476 0 45219 164587 0 0 0 17062 17414 76072 42058 0 2698 349858 0 231620 0 44736 0 0 0 0 0 2914 108 0 0 8781 0 32348 4295 0 12422 0 75071 0 0 36816 0 0 0 13216 ...
result:
Subtask #4:
score: 0
Time Limit Exceeded
Test #17:
score: 0
Time Limit Exceeded
input:
99999 99996 3 77889 1 10000000000 1 6316 86327 89644 386 3 9260 1 10000000000 2 2603 47234 69717 2 20260 73011 19290 2 62477 81233 26127 1 50140 68508 37004 98794 2 14449 22788 16063 1 43860 84932 50375 21777 1 67345 94584 28202 66610 2 661 68654 1 1 14411 94422 82738 61196 1 16563 94416 4920 38408 ...
output:
0 34602584 0 0 27739639583 1363823412 0 1902514434 1902514434 2147553884 1902514434 15794375094 0 4192446657 15797478185 13141921145 0 6351944090 5775183021 363222594 1995572111 2193350882 0 6843261316 5508935691 250667843 0 14181223499 7734049978 21958753162 12852564544 4496343819 15011219087 11331...
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
0%