Submission #580230

# Submission time Handle Problem Language Result Execution time Memory
580230 2022-06-20T18:49:35 Z adrilen Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 16296 KB
#include <bits/stdc++.h>

using namespace std;


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

    for (int i = 0; i < q; i++) {
        for (int pos = l[i]; pos <= r[i]; pos++) {
            s[pos] += v[i];
            s[pos] = min(c[pos], max(s[pos], 0));
        }
    }

    return s;
}





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


    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:27:9: warning: unused variable 'n' [-Wunused-variable]
   27 |     int n = c.size(), q = v.size();
      |         ^
candies.cpp:27:23: warning: unused variable 'q' [-Wunused-variable]
   27 |     int n = c.size(), q = v.size();
      |                       ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5096 ms 13400 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 222 ms 10292 KB Output is correct
3 Correct 209 ms 5988 KB Output is correct
4 Execution timed out 5048 ms 16296 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 543 ms 10020 KB Output is correct
4 Correct 555 ms 4700 KB Output is correct
5 Execution timed out 5057 ms 13956 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Execution timed out 5096 ms 13400 KB Time limit exceeded
7 Halted 0 ms 0 KB -