답안 #828715

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
828715 2023-08-17T14:08:04 Z fatemetmhr 사탕 분배 (IOI21_candies) C++17
38 / 100
5000 ms 11700 KB
//#pragma GCC optimize ("O3")
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops,O3")

#include "candies.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define debug(x)  cerr << "(" << (#x) << "): " << (x) << endl;
#define all(x)    x.begin(), x.end()
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define fi        first
#define se        second
#define pb        push_back
#define mp        make_pair

const int ss    = 1500;
const int maxn5 = 2e5 + 10;

int ret[maxn5], c[maxn5];
int L[maxn5], R[maxn5], V[maxn5];

std::vector<int> distribute_candies(std::vector<int> C, std::vector<int> LL,
                                    std::vector<int> RR, std::vector<int> VV) {
    int n = C.size(), q = LL.size();
    for(int i = 0; i < n; i++)
        c[i] = C[i];
    for(int i = 0; i < q; i++){
        L[i] = LL[i];
        R[i] = RR[i];
        V[i] = VV[i];
    }
    for(int tt = 0; tt < n; tt += ss){
        for(int i = 0; i < q; i++){
            int l = MAX(L[i], tt), r = MIN(R[i] + 1, MIN(tt + ss, n)), v = V[i];
            if(v > 0){
                for(int i = l; i < r; i++){
                    ret[i] = MIN(c[i], ret[i] + v);
                }
            }
            else{
                for(int i = l; i < r; i++){
                    ret[i] = MAX(0, ret[i] + v);
                }
            }
        }
    }

    std::vector<int> s;
    for(int i = 0; i < n; i++)
        s.pb(ret[i]);
    return s;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2927 ms 11612 KB Output is correct
2 Correct 2916 ms 11688 KB Output is correct
3 Correct 2910 ms 11700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 75 ms 7396 KB Output is correct
3 Correct 64 ms 5540 KB Output is correct
4 Correct 2786 ms 11660 KB Output is correct
5 Correct 2789 ms 11580 KB Output is correct
6 Correct 2816 ms 11572 KB Output is correct
7 Correct 2643 ms 11528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 119 ms 7392 KB Output is correct
4 Correct 112 ms 4552 KB Output is correct
5 Execution timed out 5026 ms 10272 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 2927 ms 11612 KB Output is correct
7 Correct 2916 ms 11688 KB Output is correct
8 Correct 2910 ms 11700 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 75 ms 7396 KB Output is correct
11 Correct 64 ms 5540 KB Output is correct
12 Correct 2786 ms 11660 KB Output is correct
13 Correct 2789 ms 11580 KB Output is correct
14 Correct 2816 ms 11572 KB Output is correct
15 Correct 2643 ms 11528 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 119 ms 7392 KB Output is correct
19 Correct 112 ms 4552 KB Output is correct
20 Execution timed out 5026 ms 10272 KB Time limit exceeded
21 Halted 0 ms 0 KB -