Submission #979325

#TimeUsernameProblemLanguageResultExecution timeMemory
979325IsamDistributing Candies (IOI21_candies)C++17
0 / 100
5062 ms12268 KiB
#include "candies.h" #include<bits/stdc++.h> using namespace std; constexpr int sz = 2e5 + 5; int n, Q; vector<int> a; vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v){ n = (int)c.size(), Q = (int)r.size(); a.assign(n, 0); for(register int q = 0; q < Q; ++q){ for(register int i = l[q]; i <= r[q]; ++i){ if(v[q] < 0){ a[i-1] = min(c[i-1], a[i-1] + v[q]); }else{ a[i-1] = max(0, a[i-1] + v[q]); } } } return a; }

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:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int q = 0; q < Q; ++q){
      |                   ^
candies.cpp:21:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |   for(register int i = l[q]; i <= r[q]; ++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...