Submission #888633

# Submission time Handle Problem Language Result Execution time Memory
888633 2023-12-18T04:40:27 Z irmuun Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13368 KB
#include<bits/stdc++.h>
#include "candies.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

vector<int>distribute_candies(vector<int>c,vector<int>l,vector<int>r,vector<int>v){
    vector<int>ans(c.size(),0);
    for(int i=0;i<l.size();i++){
        for(int j=l[i];j<=r[i];j++){
            if(v[i]>0){
                ans[j]=min(c[j],ans[j]+v[i]);
            }
            else{
                ans[j]=max(0,ans[j]+v[i]);
            }
        }
    }
    return ans;
}

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:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<l.size();i++){
      |                 ~^~~~~~~~~
# 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 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5076 ms 7416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 161 ms 8156 KB Output is correct
3 Correct 138 ms 5956 KB Output is correct
4 Execution timed out 5064 ms 13368 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 1 ms 348 KB Output is correct
3 Correct 381 ms 8024 KB Output is correct
4 Correct 347 ms 3932 KB Output is correct
5 Execution timed out 5099 ms 10832 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 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Execution timed out 5076 ms 7416 KB Time limit exceeded
7 Halted 0 ms 0 KB -