답안 #799248

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799248 2023-07-31T11:11:11 Z bane Watering can (POI13_kon) C++17
80 / 100
4000 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 = 1450;
ll N, K, t[nax], zers[nax], ans[nax];
 
int mapa[207][300001];
 
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] <= 300000)
            mapa[i / sq][-(K - t[i]) + 300000]++;
        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][300000 - zers[i]];
        }else{
            ans[i] = 0;
            for (int j = i * sq; j / sq == i && j < N; j++){
                if (K >= t[j] && K - t[j] <= 300000)
                    mapa[i][-(K - t[j]) + 300000]--;
                t[j] += zers[i];
                if (j >= a && j <= b)t[j]++;
                if (K >= t[j] && K - t[j] <= 300000){
                    mapa[i][- (K - t[j]) + 300000]++;
                }
                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 1488 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 5 ms 1496 KB Output is correct
2 Correct 17 ms 1620 KB Output is correct
3 Correct 1 ms 1492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 460 ms 2608 KB Output is correct
2 Correct 477 ms 2372 KB Output is correct
3 Correct 396 ms 2372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 709 ms 3084 KB Output is correct
2 Correct 876 ms 4232 KB Output is correct
3 Correct 714 ms 2548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1308 ms 72868 KB Output is correct
2 Correct 898 ms 56288 KB Output is correct
3 Correct 955 ms 2952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3344 ms 101304 KB Output is correct
2 Correct 1904 ms 65488 KB Output is correct
3 Correct 2161 ms 3520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2425 ms 95596 KB Output is correct
2 Correct 2122 ms 115372 KB Output is correct
3 Correct 1983 ms 4896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 838 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3367 ms 19760 KB Output is correct
2 Correct 2639 ms 12620 KB Output is correct
3 Correct 3335 ms 10160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3458 ms 18164 KB Output is correct
2 Correct 3048 ms 16348 KB Output is correct
3 Execution timed out 4003 ms 6604 KB Time limit exceeded
4 Halted 0 ms 0 KB -