답안 #618085

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
618085 2022-08-01T21:40:38 Z BalintR 사탕 분배 (IOI21_candies) C++17
38 / 100
5000 ms 8900 KB
#include <vector>
using namespace std;
#pragma GCC target "avx2"
#pragma GCC optimize "Ofast"
typedef vector<int> vi;
#define SZ(v) ((int) (v).size())
#define min(a, b) ((a)<(b)?(a):(b))
#define max(a, b) ((a)<(b)?(b):(a))

const int MN = 2e5;
int n, q;
int arr[MN], cap[MN];

vi distribute_candies(vi cIn, vi lIn, vi rIn, vi vIn){
    n = SZ(cIn);
    q = SZ(lIn);
    for(int i = 0; i < n; i++) cap[i] = cIn[i];

    for(int i = 0; i < q; i++){
        int l = lIn[i], r = rIn[i]+1, v = vIn[i];
        if(v < 0) for(int j = l; j < r; j++) arr[j] = max(arr[j] + v, 0);
        else for(int j = l; j < r; j++) arr[j] = min(arr[j] + v, cap[j]);
    }

    vi res(n);
    for(int i = 0; i < n; i++) res[i] = arr[i];
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 2982 ms 8896 KB Output is correct
2 Correct 3236 ms 8900 KB Output is correct
3 Correct 3261 ms 8896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 91 ms 5036 KB Output is correct
3 Correct 76 ms 5368 KB Output is correct
4 Correct 2891 ms 8892 KB Output is correct
5 Correct 2794 ms 8900 KB Output is correct
6 Correct 2774 ms 8892 KB Output is correct
7 Correct 2748 ms 8896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 108 ms 5040 KB Output is correct
4 Correct 117 ms 4348 KB Output is correct
5 Execution timed out 5066 ms 8012 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 2982 ms 8896 KB Output is correct
7 Correct 3236 ms 8900 KB Output is correct
8 Correct 3261 ms 8896 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 91 ms 5036 KB Output is correct
11 Correct 76 ms 5368 KB Output is correct
12 Correct 2891 ms 8892 KB Output is correct
13 Correct 2794 ms 8900 KB Output is correct
14 Correct 2774 ms 8892 KB Output is correct
15 Correct 2748 ms 8896 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 108 ms 5040 KB Output is correct
19 Correct 117 ms 4348 KB Output is correct
20 Execution timed out 5066 ms 8012 KB Time limit exceeded
21 Halted 0 ms 0 KB -