답안 #467485

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
467485 2021-08-23T08:16:11 Z oliversommer 사탕 분배 (IOI21_candies) C++17
3 / 100
5000 ms 12704 KB
#include "candies.h"

#include <algorithm>
#include <vector>

using namespace std;

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
	int n = c.size();
	vector<int> s(n);

	for (int j = 0; j < l.size(); ++j) {
		for (int k = l[j]; k <= r[j]; ++k) {
			if (v[j] > 0) {
				s[k] = min(c[k], s[k] + v[j]);
			}
            else {
            	s[k] = max(0, s[k] + v[j]);    
            }
		}
	}

	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:12:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for (int j = 0; j < l.size(); ++j) {
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 276 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5020 ms 11516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 207 ms 8004 KB Output is correct
3 Correct 197 ms 5996 KB Output is correct
4 Execution timed out 5060 ms 12704 KB Time limit exceeded
5 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 461 ms 7628 KB Output is correct
4 Correct 477 ms 3984 KB Output is correct
5 Execution timed out 5091 ms 10828 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 276 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Execution timed out 5020 ms 11516 KB Time limit exceeded
7 Halted 0 ms 0 KB -