# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532484 | scottchou | Snowball (JOI21_ho_t2) | C++17 | 1 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long LL;
int const N = 2e5 + 5;
LL a[N];
vector<LL> line, ans;
LL sum[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n, q;
cin >> n >> q;
for(int i = 0; i < n; i++){
cin >> a[i];
if(i != 0){
line.push_back(a[i] - a[i - 1]);
}
}
sort(line.begin(), line.end());
line.resize(unique(line.begin(), line.end()) - line.begin());
ans.resize(line.size());
int nowx = 0, w, left = 0, right = 0, idx = 0;
for(int i = 0; i < q; i++){
cin >> w;
nowx += w;
if(nowx < 0)
left = max(left, -nowx);
else
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |