Submission #545866

# Submission time Handle Problem Language Result Execution time Memory
545866 2022-04-05T15:36:29 Z fuad27 Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13228 KB
#include<bits/stdc++.h>
#include "candies.h"
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, 0);
	for(int i = 0;i<r.size();i++) {
		for(int j = 0;j<n;j++) {
			if(j >= l[i] and j <= r[i]) {
				if(v[i] > 0) {
					s[j] = min(c[j], s[j] + v[i]);
				}
				else {
					s[j] = max(0, s[j] + 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:7:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |  for(int i = 0;i<r.size();i++) {
      |                ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 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 2 ms 340 KB Output is correct
5 Correct 6 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5089 ms 7228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 459 ms 5028 KB Output is correct
3 Correct 438 ms 6024 KB Output is correct
4 Execution timed out 5068 ms 13228 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 631 ms 7664 KB Output is correct
4 Correct 613 ms 4028 KB Output is correct
5 Execution timed out 5077 ms 10804 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 2 ms 340 KB Output is correct
5 Correct 6 ms 340 KB Output is correct
6 Execution timed out 5089 ms 7228 KB Time limit exceeded
7 Halted 0 ms 0 KB -