답안 #800184

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
800184 2023-08-01T11:23:39 Z Ellinor 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 13268 KB
#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
#define pb push_back
typedef pair<int, int> pii;


#include "candies.h"

// #include <vector>


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();
    int Q = l.size();


    vector<int> s(N, 0);

    rep(i,0,Q)
    {
        int li = l[i], ri = r[i], vv = v[i];
        rep(j,li,ri+1)
        {
            if (vv > 0) s[j] = min(c[j], s[j] + vv);
            else s[j] = max(0, s[j] + vv);
        }
    }

    return s;
}


// int32_t main()
// {
//     vector<int> ans = distribute_candies({10, 15, 13}, {0, 0}, {2, 1}, {20, -11});

//     rep(i,0,ans.size())
//     {
//         cerr << ans[i] << " ";
//     }
// }
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 292 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 Execution timed out 5024 ms 12108 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 163 ms 8032 KB Output is correct
3 Correct 157 ms 5900 KB Output is correct
4 Execution timed out 5042 ms 13268 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 397 ms 7664 KB Output is correct
4 Correct 350 ms 3900 KB Output is correct
5 Execution timed out 5057 ms 10840 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 292 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 Execution timed out 5024 ms 12108 KB Time limit exceeded
7 Halted 0 ms 0 KB -