Submission #677874

# Submission time Handle Problem Language Result Execution time Memory
677874 2023-01-04T13:49:34 Z APROHACK Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13556 KB
#include "candies.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
using namespace std;
int n, q;
vector<int>s;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    n = c.size();
    q = l.size();
    for (int i = 0; i < n; i++)
    {
        s.pb(0);
    }
    
    for(int i = 0 ; i < q ; i  ++){
        for(int j = l[i] ; j <= r[i] ; j  ++){
            if(v[i] > 0){
                s[j] = min(c[j], v[i]+s[j]);
                //cout << "s[" << j << "] = " << s[j] << endl; 
            }else{
                s[j] = max(0, s[j]+v[i] );
                // << "s[" << j << "] = " << s[j] << endl;
            }
        }
    }

    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 340 KB Output is correct
5 Correct 3 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5050 ms 12484 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 186 ms 8052 KB Output is correct
3 Correct 185 ms 6928 KB Output is correct
4 Execution timed out 5024 ms 13556 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 300 KB Output is correct
3 Correct 476 ms 7668 KB Output is correct
4 Correct 445 ms 4908 KB Output is correct
5 Execution timed out 5026 ms 11176 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 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 3 ms 308 KB Output is correct
6 Execution timed out 5050 ms 12484 KB Time limit exceeded
7 Halted 0 ms 0 KB -