Submission #1038284

# Submission time Handle Problem Language Result Execution time Memory
1038284 2024-07-29T15:31:59 Z Marco_Escandon Distributing Candies (IOI21_candies) C++17
38 / 100
5000 ms 14216 KB
#pragma GCC optimize("O3") 
#pragma GCC optimize("unroll-loops") 
  
#include "candies.h" 
#include <bits/stdc++.h> 
  
using namespace std; 
  
const int MAXN = 2e5; 
const int T = 700; 
  
int A[MAXN]; 
  
vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { 
 int q = l.size(), n = c.size(); 
 vector<int> A(n, 0); 
 for (int s = 0; s < MAXN; s += T) { 
  int fl = s, fr = s + T - 1; 
  
  for (int i = 0; i < q; i++) { 
   int tl = (fl > l[i] ? fl : l[i]); 
   int tr = (fr < r[i] ? fr : r[i]); 
   for (int j = tl; j <= tr; j++) { 
    A[j] = A[j] + v[i]; 
    A[j] = (A[j] >= c[j] ? c[j] : A[j]);  
    A[j] = (A[j] >= 0 ? A[j] : 0); 
   } 
  } 
 } 
  
 return A; 
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2924 ms 7248 KB Output is correct
2 Correct 2754 ms 11372 KB Output is correct
3 Correct 2857 ms 11420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 123 ms 5168 KB Output is correct
3 Correct 58 ms 3808 KB Output is correct
4 Correct 2681 ms 7248 KB Output is correct
5 Correct 2836 ms 13828 KB Output is correct
6 Correct 2638 ms 14216 KB Output is correct
7 Correct 2697 ms 13556 KB Output is correct
# 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 143 ms 5372 KB Output is correct
4 Correct 117 ms 2880 KB Output is correct
5 Execution timed out 5043 ms 7248 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 516 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2924 ms 7248 KB Output is correct
7 Correct 2754 ms 11372 KB Output is correct
8 Correct 2857 ms 11420 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 123 ms 5168 KB Output is correct
11 Correct 58 ms 3808 KB Output is correct
12 Correct 2681 ms 7248 KB Output is correct
13 Correct 2836 ms 13828 KB Output is correct
14 Correct 2638 ms 14216 KB Output is correct
15 Correct 2697 ms 13556 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 143 ms 5372 KB Output is correct
19 Correct 117 ms 2880 KB Output is correct
20 Execution timed out 5043 ms 7248 KB Time limit exceeded
21 Halted 0 ms 0 KB -