# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
710982 | emptypringlescan | Rainy Markets (CCO22_day1problem2) | C++17 | 526 ms | 63232 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
long long cap[n],pop[n-1],um[n-1];
for(int i=0; i<n; i++) cin >> cap[i];
for(int i=0; i<n-1; i++) cin >> pop[i];
for(int i=0; i<n-1; i++) cin >> um[i];
bool cant=false;
long long left=cap[0];
for(int i=0; i<n-1; i++){
long long peep=max(pop[i]-left-um[i],0LL);
left=cap[i+1]-peep;
if(left<0) cant=true;
}
if(cant){
cout << "NO";
return 0;
}
long long fill[n],buy[n-1];
memset(fill,0,sizeof(fill));
memset(buy,0,sizeof(buy));
for(int i=0; i<n-1; i++){
long long space=cap[i]-fill[i],peep=pop[i];
if(space>=pop[i]){
fill[i]+=pop[i];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |