# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
799236 |
2023-07-31T11:00:00 Z |
bane |
Watering can (POI13_kon) |
C++17 |
|
2677 ms |
101088 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 = 910;
ll N, K, t[nax], zers[nax], ans[nax];
int mapa[332][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 |
1492 KB |
Output is correct |
2 |
Correct |
14 ms |
1556 KB |
Output is correct |
3 |
Correct |
1 ms |
1492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
305 ms |
2000 KB |
Output is correct |
2 |
Correct |
324 ms |
1784 KB |
Output is correct |
3 |
Correct |
266 ms |
2028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
480 ms |
2236 KB |
Output is correct |
2 |
Correct |
580 ms |
2500 KB |
Output is correct |
3 |
Correct |
474 ms |
2160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
677 ms |
39488 KB |
Output is correct |
2 |
Correct |
574 ms |
30992 KB |
Output is correct |
3 |
Correct |
647 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1639 ms |
55080 KB |
Output is correct |
2 |
Correct |
953 ms |
35604 KB |
Output is correct |
3 |
Correct |
1423 ms |
3060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1467 ms |
47284 KB |
Output is correct |
2 |
Correct |
1227 ms |
58020 KB |
Output is correct |
3 |
Correct |
1315 ms |
4712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2062 ms |
93112 KB |
Output is correct |
2 |
Correct |
2556 ms |
101088 KB |
Output is correct |
3 |
Correct |
2362 ms |
15660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2239 ms |
10680 KB |
Output is correct |
2 |
Correct |
1775 ms |
8480 KB |
Output is correct |
3 |
Correct |
2196 ms |
11476 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2302 ms |
8584 KB |
Output is correct |
2 |
Correct |
2039 ms |
8156 KB |
Output is correct |
3 |
Correct |
2677 ms |
6292 KB |
Output is correct |