Submission #1043461

# Submission time Handle Problem Language Result Execution time Memory
1043461 2024-08-04T09:46:46 Z DorostWef Distributing Candies (IOI21_candies) C++17
38 / 100
5000 ms 11392 KB
#include "candies.h"

#include <bits/stdc++.h>

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")

#define Min(a,b) ((a)<(b)?(a):(b))
#define Max(a,b) ((a)>(b)?(a):(b))

using namespace std;
const int N = 200004;
int a[N], ll[N], rr[N], cc[N], vv[N];

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();
    int q = (int)l.size();
   	for (int i = 0; i < q; i++) {
   		ll[i] = l[i];
   		rr[i] = r[i];
   		vv[i] = v[i];
	}
	for (int i = 0; i < n; i++)
		cc[i] = c[i];
    for (int i = 0; i < q; i++) {
    	for (int j = ll[i]; j <= rr[i]; j++) {
    		a[j] = Min (a[j] + vv[i], cc[j]);
    		a[j] = Max (a[j], 0);
		}
	}
    std::vector<int> s(n);
    for (int i = 0; i < n; i++)
    	s[i] = a[i];
    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1943 ms 11388 KB Output is correct
2 Correct 1830 ms 11392 KB Output is correct
3 Correct 1819 ms 11388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 47 ms 8276 KB Output is correct
3 Correct 46 ms 6724 KB Output is correct
4 Correct 1886 ms 11348 KB Output is correct
5 Correct 1912 ms 11268 KB Output is correct
6 Correct 1942 ms 11392 KB Output is correct
7 Correct 1849 ms 11388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 81 ms 8168 KB Output is correct
4 Correct 75 ms 5684 KB Output is correct
5 Execution timed out 5038 ms 10576 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1943 ms 11388 KB Output is correct
7 Correct 1830 ms 11392 KB Output is correct
8 Correct 1819 ms 11388 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 47 ms 8276 KB Output is correct
11 Correct 46 ms 6724 KB Output is correct
12 Correct 1886 ms 11348 KB Output is correct
13 Correct 1912 ms 11268 KB Output is correct
14 Correct 1942 ms 11392 KB Output is correct
15 Correct 1849 ms 11388 KB Output is correct
16 Correct 1 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 81 ms 8168 KB Output is correct
19 Correct 75 ms 5684 KB Output is correct
20 Execution timed out 5038 ms 10576 KB Time limit exceeded
21 Halted 0 ms 0 KB -