#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <string.h>
#include <bitset>
#include <numeric>
#include <utility>
#include<math.h>
using namespace std;
#define ll long long
const int nax = 300'001;
int sq = 550;
ll N, K, t[nax], zers[nax], ans[nax];
int mapa[550][600000];
void inicjuj(int n, int k, int *D)
{
sq = min(550, (int)sqrt(n) + 1);
for (int i = 0; i < n; i++){
t[i] = D[i];
}
N = n, K = k;
for (int i = 0; i < n; i++){
if (K>=t[i] && K - t[i] <= 400000)
mapa[i / sq][500000 - (K - t[i])]++;
if (t[i] >= K)ans[i / sq]++;
}
}
void podlej(int a, int b)
{
//--a,--b;
int from = a/sq, to = (b / sq);
for (int i = from; i <= to; i++){
if (a <= i * sq && b >= (i + 1) * sq - 1){
zers[i]++;
ans[i] += mapa[i][500000 - zers[i]];
}else{
ans[i] = 0;
for (int j = i * sq; j / sq == i && j < N; j++){
if (K >= t[j] && K - t[j] <= 400000)
mapa[i][-(K - t[j]) + 500000]--;
t[j] += zers[i];
if (j >= a && j <= b)t[j]++;
if (K >= t[j] && K - t[j] <= 400000){
mapa[i][-(K - t[j])+ 500000]++;
}
if (t[j] >= K)ans[i]++;
}
zers[i] = 0;
}
}
}
int dojrzale(int a, int b)
{
// --a,--b;
int odg = 0;
int from = a/sq, to = (b / sq);
for (int i = from; i <= to; i++){
if (a <= i * sq && b >= (i + 1) * sq - 1){
odg += ans[i];
}else{
for (int j = max(a, i * sq); j / sq == i && j <= b; j++){
odg += (t[j] + zers[i] >= K);
}
}
}
return odg;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1492 KB |
Output is correct |
2 |
Correct |
1 ms |
1492 KB |
Output is correct |
3 |
Correct |
1 ms |
1492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1748 KB |
Output is correct |
2 |
Correct |
3 ms |
2260 KB |
Output is correct |
3 |
Correct |
1 ms |
1492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
84 ms |
2812 KB |
Output is correct |
2 |
Correct |
78 ms |
2940 KB |
Output is correct |
3 |
Correct |
68 ms |
3132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
137 ms |
3388 KB |
Output is correct |
2 |
Correct |
180 ms |
4636 KB |
Output is correct |
3 |
Correct |
145 ms |
3600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
73 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
61 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
317 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
188 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1480 ms |
25380 KB |
Output is correct |
2 |
Correct |
1155 ms |
16292 KB |
Output is correct |
3 |
Correct |
1372 ms |
17916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1526 ms |
24784 KB |
Output is correct |
2 |
Correct |
1357 ms |
19884 KB |
Output is correct |
3 |
Correct |
1744 ms |
9148 KB |
Output is correct |