답안 #796709

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
796709 2023-07-28T15:55:24 Z Minindu206 사탕 분배 (IOI21_candies) C++17
3 / 100
83 ms 7964 KB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    int n = c.size(), q = l.size();
    vector<int> candies(n, 0);
    if(n <= 2000 && q <= 2000)
    {
        for(int i=0;i<q;i++)
        {
            int ll = l[i], rr = r[i];
            while(ll <= rr)
            {
                candies[ll] += v[i];
                if(candies[ll] > c[ll])
                    candies[ll] = c[ll];
                if(candies[ll] < 0)
                    candies[ll] = 0;
                ll++;
            }
        }
        return candies;
    }
    else
    {
        int ans = 0;
        for(int val:v)
            ans += val;
        for(int i=0;i<n;i++)
            candies[i] = min(ans, c[i]);
        return candies;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 83 ms 7528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 43 ms 7964 KB Output isn't correct
3 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 Incorrect 44 ms 7636 KB Output isn't correct
4 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 1 ms 340 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Incorrect 83 ms 7528 KB Output isn't correct
7 Halted 0 ms 0 KB -