QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#116824 | #149. Peru | Linshey# | 0 | 188ms | 31820kb | C++14 | 1.5kb | 2023-06-30 08:56:55 | 2024-09-10 16:34:10 |
Judging History
你现在查看的是最新测评结果
- [2024-05-31 18:30:21]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-06-30 08:56:55]
- 提交
answer
#include <bits/stdc++.h>
#include "peru.h"
using namespace std; const int maxn = 2.5e6 + 5, mod = 1e9 + 7; typedef long long ll;
ll tr[maxn << 2], tg[maxn << 2];
inline void C(int u, ll k) { tr[u] += k, tg[u] += k; }
inline void spread(int u) { C(u << 1, tg[u]), C(u << 1 | 1, tg[u]), tg[u] = 0; }
void update(int u, int l, int r, int ul, int ur, ll k)
{
if (ul <= l && r <= ur) return C(u, k); int mid = l + r >> 1; spread(u);
if (ul <= mid) update(u << 1, l, mid, ul, ur, k); if (ur > mid) update(u << 1 | 1, mid + 1, r, ul, ur, k);
tr[u] = min(tr[u << 1], tr[u << 1 | 1]);
}
ll ask(int u, int l, int r, int ul, int ur)
{
if (ul <= l && r <= ur) return tr[u]; int mid = l + r >> 1; spread(u); ll res = 1e18;
if (ul <= mid) res = min(res, ask(u << 1, l, mid, ul, ur));
if (ur > mid) res = min(res, ask(u << 1 | 1, mid + 1, r, ul, ur)); return res;
}
ll X[maxn];
int sk[maxn], tp;
int solve(int n, int k, int* v)
{
sk[tp = 0] = -1;
for (int i = 0; i < n; i++)
{
while (tp && v[sk[tp]] <= v[i]) update(1, 0, n, sk[tp - 1] + 1, sk[tp], v[i] - v[sk[tp]]), tp--;
// update(1, 0, n, i, i, v[i]);
sk[++tp] = i;
X[i] = ask(1, 0, n, max(0, i - k + 1), i);
if (i + 1 < n)
update(1, 0, n, i + 1, i + 1, X[i] + v[i + 1]);
}
int ans = 0;
for (int i = 0; i < n; i++) ans = (23ll * ans + X[i]) % mod;
// for (int i = 0; i < n; i++) cerr << X[i] << ' '; cerr << endl;
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 9992kb
input:
2000 170 1054018657 1037445664 1011691297 1009972317 1006506677 1002579733 999792775 999477541 975467893 970302369 968173111 957735623 953086083 938540451 932313113 930563895 924682633 917831575 913506401 908739591 905368525 899452913 894354220 890127447 885923007 583391543 880642788 878397752 87822...
output:
14822714
result:
wrong answer 1st lines differ - expected: '559335223', found: '14822714'
Subtask #2:
score: 0
Wrong Answer
Test #15:
score: 0
Wrong Answer
time: 188ms
memory: 31820kb
input:
400000 1000 1999989721 1999987224 1999984551 1999977673 1999977545 1999976801 1999975837 1999972607 1999956301 1999952801 1999942489 1999940593 1999940337 1999936353 1999936273 1999926073 1999925513 1999922980 1999918301 1999912501 1999909301 1999906125 1999902913 1999895622 1999893617 1999885490 19...
output:
998451579
result:
wrong answer 1st lines differ - expected: '677928817', found: '998451579'
Subtask #3:
score: 0
Time Limit Exceeded
Test #34:
score: 0
Time Limit Exceeded
input:
2500000 2000 1073315871 1073250349 1072791751 1072104046 1072071097 1071841833 1071809381 1071710686 1071580105 1071482003 1071383725 1071154701 1070499431 1070335288 1070334157 1069943617 1069681476 1069584279 1069581771 1069322519 1069189353 1069125955 1068832186 1068797487 1068662939 1068565681 1...