Submission #436191

# Submission time Handle Problem Language Result Execution time Memory
436191 2021-06-24T10:11:21 Z Bom164 Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 7260 KB
#include<bits/stdc++.h>
#include<iostream>

using namespace std;

#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define mod             1000000007
#define inf             1e18
#define w(x)            int x; cin>>x; while(x--)

vector<int> distribute_candies(vector<int> c,vector<int> l,vector<int> r,vector<int> v){
    int n=c.size();
    int q=l.size();
    vector<int> s(n,0);
    for(int i=0;i<q;i++){
        int left=l[i];
        int right=r[i];
        for(int j=left;j<=right;j++){
            s[j] = max(s[j] + v[i], 0);
            s[j] = min(s[j], c[j]);
        }
    }
    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5057 ms 7224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 220 ms 5016 KB Output is correct
3 Correct 205 ms 3876 KB Output is correct
4 Execution timed out 5024 ms 7236 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 521 ms 5016 KB Output is correct
4 Correct 515 ms 2800 KB Output is correct
5 Execution timed out 5027 ms 7260 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 4 ms 332 KB Output is correct
6 Execution timed out 5057 ms 7224 KB Time limit exceeded
7 Halted 0 ms 0 KB -