답안 #819908

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819908 2023-08-10T15:21:38 Z Marco_Escandon 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 14032 KB
#include<bits/stdc++.h>
typedef long long  ll;
using namespace std;
std::vector<int> distribute_candies(std::vector<int> cad, std::vector<int> l, std::vector<int> r, std::vector<int> v)
{
    ll t[cad.size()+5]={};
    ll n=cad.size();
    for(int i=0; i<l.size(); i++)
    {
        for(int j=l[i]; j<=r[i]; j++)
        {
            t[j]+=v[i];
            t[j]=max(0LL,t[j]);
            t[j]=min((ll)cad[j],t[j]);
        }
    }

    cad[0]=min(t[0],(ll)cad[0]);
    for(int i=1; i<n; i++)
    {
        cad[i]=min(t[i],(ll)cad[i]);

    }
    return cad;
}

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:8:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i=0; i<l.size(); i++)
      |                  ~^~~~~~~~~
# 결과 실행 시간 메모리 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 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5086 ms 12960 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 167 ms 8012 KB Output is correct
3 Correct 164 ms 7576 KB Output is correct
4 Execution timed out 5068 ms 14032 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 300 KB Output is correct
3 Correct 411 ms 7660 KB Output is correct
4 Correct 431 ms 5568 KB Output is correct
5 Execution timed out 5064 ms 11552 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 316 KB Output is correct
6 Execution timed out 5086 ms 12960 KB Time limit exceeded
7 Halted 0 ms 0 KB -