답안 #438159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
438159 2021-06-27T17:01:19 Z victoriad 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 9796 KB
#include "candies.h"
 
#include <vector>
using namespace std;
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();
   vector<int> s(n,0);
   for(int i=0;i<v.size();i++){
       for(int k=l[i];k<=r[i];k++){
           if(v[i]>0){
               s[k]=min(c[k],s[k]+v[i]);
           }
           else{
               s[k]=max(0,s[k]+v[i]);
           }
       }
   }
    return s;
}

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:9:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |    for(int i=0;i<v.size();i++){
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 292 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5045 ms 7256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 215 ms 6764 KB Output is correct
3 Correct 204 ms 4884 KB Output is correct
4 Execution timed out 5030 ms 9796 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 465 ms 6600 KB Output is correct
4 Correct 471 ms 3656 KB Output is correct
5 Execution timed out 5040 ms 9028 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 292 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Execution timed out 5045 ms 7256 KB Time limit exceeded
7 Halted 0 ms 0 KB -