Submission #885643

# Submission time Handle Problem Language Result Execution time Memory
885643 2023-12-10T10:50:51 Z epicci23 Distributing Candies (IOI21_candies) C++17
8 / 100
77 ms 12884 KB
#include "candies.h"
#include "bits/stdc++.h"
#define pb push_back
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())

vector<int> distribute_candies(vector<int> c,vector<int> l,
                                      vector<int> r, vector<int> v) {
  int n=sz(c),q=sz(l);
  vector<ll> cur(n,0);
  for(int i=0;i<q;i++){
    cur[l[i]]+=v[i];
    if(r[i]+1<n) cur[r[i]+1]-=v[i];
  }
  for(int i=1;i<n;i++) cur[i]+=cur[i-1];
  for(int i=0;i<n;i++) cur[i]=min(cur[i],1LL*c[i]);
  vector<int> res(n);
  for(int i=0;i<n;i++) res[i]=(int)cur[i];
  return res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 77 ms 9040 KB Output is correct
2 Correct 76 ms 12884 KB Output is correct
3 Correct 77 ms 12764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -