(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #602769

#TimeUsernameProblemLanguageResultExecution timeMemory
602769SifferDistributing Candies (IOI21_candies)C++17
8 / 100
128 ms15444 KiB
#include "candies.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> s; ll gett(int i) { i += s.size()>>1; ll r = 0; for(;i;i>>=1) r += s[i]; return r; } void up(int a, int b, ll v) { a += s.size()>>1; b += s.size()>>1; for(;a <= b; a >>= 1, b >>= 1) { if(a&1) s[a] += v, a++; if((b&1)==0) s[b] += v, b--; } } vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { int n = c.size(); int p = 1; for(;p <= n; p <<= 1); p <<= 1; s.resize(p,0); for(int i = 0; i < l.size(); i++) up(l[i],r[i],v[i]); vector<int> k(n,0); for(int i = 0; i < n; i++) k[i] = min(gett(i), c[i]+0ll); return k; }

Compilation message (stderr)

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:28:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i = 0; i < l.size(); i++) up(l[i],r[i],v[i]);
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...