제출 #826847

#제출 시각아이디문제언어결과실행 시간메모리
826847Sohsoh84사탕 분배 (IOI21_candies)C++17
3 / 100
5075 ms7296 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("avx2") #include "candies.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 2e5; int A[MAXN]; vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) { int q = l.size(), n = c.size(); for (int i = 0; i < q; i++) { if (v[i] >= 0) { for (int j = l[i]; j <= r[i]; j++) { A[j] = (A[j] + v[i] >= c[j] ? c[j] : A[j] + v[i]); } } else { for (int j = l[i]; j <= r[i]; j++) { A[j] = (A[j] + v[i] >= 0 ? A[j] + v[i] : 0); } } } vector<int> ans; for (int i = 0; i < n; i++) ans.push_back(A[i]); return ans; }
#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...