답안 #446438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
446438 2021-07-21T23:20:25 Z luciocf 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 7236 KB
#include <bits/stdc++.h>
#include "candies.h"

using namespace std;

const int maxn = 2e5+10;

int value(int v, int add, int C)
{
    if (add + v > C) return C;
    if (add + v < 0) return 0;
    return add+v;
}

int a[maxn];

vector<int> distribute_candies(vector<int> c, vector<int> L, vector<int> R, vector<int> V)
{
    int n = c.size(), q = L.size();
    
    for (int i = 0; i < q; i++)
    {
        for (int j = L[i]; j <= R[i]; j++)
            a[j] = value(a[j], V[i], c[j]);
    }

    vector<int> ans;

    for (int i = 0; i < n; i++)
        ans.push_back(a[i]);
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 5 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5099 ms 7228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 217 ms 5032 KB Output is correct
3 Correct 210 ms 4644 KB Output is correct
4 Execution timed out 5099 ms 7236 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1025 ms 5028 KB Output is correct
4 Correct 1529 ms 3840 KB Output is correct
5 Execution timed out 5072 ms 7236 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 5 ms 332 KB Output is correct
6 Execution timed out 5099 ms 7228 KB Time limit exceeded
7 Halted 0 ms 0 KB -