답안 #1007807

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1007807 2024-06-25T13:45:56 Z jer033 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 13148 KB
#include "candies.h"

#include <vector>
#include <bits/stdc++.h>
using namespace std;

int bound(int a, int b)
{
    if (a<0)
        return 0;
    if (a>b)
        return b;
    return a;
}


std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    int n = c.size();
    std::vector<int> s(n, 0);
    int q = v.size();
    for (int i=0; i<q; i++)
    {
        for (int j=l[i]; j<=r[i]; j++)
        {
            if (v[i]>0)
            {
                s[j] = min(c[j], s[j]+v[i]);
            }
            else
            {
                s[j] = max(0, s[j]+v[i]);
            }
        }
    }
    return s;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5089 ms 7400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 119 ms 8164 KB Output is correct
3 Correct 108 ms 5956 KB Output is correct
4 Execution timed out 5060 ms 13148 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 292 ms 7720 KB Output is correct
4 Correct 290 ms 3932 KB Output is correct
5 Execution timed out 5032 ms 10808 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Execution timed out 5089 ms 7400 KB Time limit exceeded
7 Halted 0 ms 0 KB -