Submission #439556

#TimeUsernameProblemLanguageResultExecution timeMemory
439556QuantumK9Distributing Candies (IOI21_candies)C++17
3 / 100
5093 ms12220 KiB
#include "candies.h" #include <bits/stdc++.h> using namespace std; vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { int n = c.size(); vector<int> s(n); for( int i = 0; i < n; i++ ){ s[i] = 0; } int q = v.size(); for( int i = 0; i < q; i++ ){ //per query for( int j = l[i]; j <= r[i]; j++ ){ if( v[i] > 0 ){ s[j] = min( c[j], s[j]+v[i] ); } else if ( v[i] < 0 ){ s[j] = max( 0, s[j]+v[i] ); } } //for( int k = 0; k < n; k++ ){ cout << s[k] << " "; } cout << endl; } return s; }
#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...