Submission #1043443

# Submission time Handle Problem Language Result Execution time Memory
1043443 2024-08-04T09:33:54 Z DorostWef Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13396 KB
#include "candies.h"
#define Min(a,b) ((a)<(b)?(a):(b))
#define Max(a,b) ((a)>(b)?(a):(b))

#include <bits/stdc++.h>

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

using namespace std;
const int N = 200004;
int a[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++) {
    	for (int j = l[i]; j <= r[i]; j++) {
    		a[j] += v[i];
    		a[j] = Min (a[j], c[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 0 ms 348 KB Output is correct
2 Correct 0 ms 444 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 492 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5081 ms 12140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 109 ms 7984 KB Output is correct
3 Correct 111 ms 6720 KB Output is correct
4 Execution timed out 5061 ms 13396 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 289 ms 7876 KB Output is correct
4 Correct 263 ms 4928 KB Output is correct
5 Execution timed out 5066 ms 10840 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 444 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 492 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Execution timed out 5081 ms 12140 KB Time limit exceeded
7 Halted 0 ms 0 KB -