Submission #799189

# Submission time Handle Problem Language Result Execution time Memory
799189 2023-07-31T10:38:29 Z bane Watering can (POI13_kon) C++17
0 / 100
183 ms 131072 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 = 500;
ll N, K, t[nax], zers[nax], ans[nax];
 
int mapa[525][600000];
 
void inicjuj(int n, int k, int *D)
{
    sq = min(500, (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])+ 400000]++;
                }
                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 Incorrect 1 ms 1492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 3124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 130 ms 4064 KB Output is correct
2 Correct 183 ms 6480 KB Output is correct
3 Incorrect 139 ms 4536 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 53 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 55 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 164 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 123 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 39 ms 4796 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 4928 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -