# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
799243 |
2023-07-31T11:05:57 Z |
bane |
Watering can (POI13_kon) |
C++17 |
|
3884 ms |
63512 KB |
#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 = 1400;
ll N, K, t[nax], zers[nax], ans[nax];
int mapa[216][100001];
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] <= 100000)
mapa[i / sq][-(K - t[i]) + 100000]++;
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][100000 - zers[i]];
}else{
ans[i] = 0;
for (int j = i * sq; j / sq == i && j < N; j++){
if (K >= t[j] && K - t[j] <= 100000)
mapa[i][-(K - t[j]) + 100000]--;
t[j] += zers[i];
if (j >= a && j <= b)t[j]++;
if (K >= t[j] && K - t[j] <= 100000){
mapa[i][- (K - t[j]) + 100000]++;
}
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;
}
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1520 KB |
Output is correct |
2 |
Correct |
17 ms |
1536 KB |
Output is correct |
3 |
Correct |
1 ms |
1492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
442 ms |
2008 KB |
Output is correct |
2 |
Correct |
480 ms |
1828 KB |
Output is correct |
3 |
Correct |
380 ms |
1984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
702 ms |
2204 KB |
Output is correct |
2 |
Correct |
845 ms |
2296 KB |
Output is correct |
3 |
Correct |
691 ms |
2056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
974 ms |
26880 KB |
Output is correct |
2 |
Correct |
797 ms |
21284 KB |
Output is correct |
3 |
Correct |
926 ms |
2716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2167 ms |
36968 KB |
Output is correct |
2 |
Correct |
1347 ms |
24456 KB |
Output is correct |
3 |
Correct |
2103 ms |
2888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2145 ms |
34568 KB |
Output is correct |
2 |
Correct |
1778 ms |
41544 KB |
Output is correct |
3 |
Correct |
1877 ms |
4280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2959 ms |
62004 KB |
Output is correct |
2 |
Correct |
3816 ms |
63512 KB |
Output is correct |
3 |
Correct |
3466 ms |
4816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3227 ms |
10604 KB |
Output is correct |
2 |
Correct |
2556 ms |
8448 KB |
Output is correct |
3 |
Correct |
3197 ms |
9360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3337 ms |
8580 KB |
Output is correct |
2 |
Correct |
2939 ms |
8064 KB |
Output is correct |
3 |
Correct |
3884 ms |
5780 KB |
Output is correct |