제출 #1151465

#제출 시각아이디문제언어결과실행 시간메모리
1151465Muhammad_AneeqBikeparking (EGOI24_bikeparking)C++20
25 / 100
22 ms2632 KiB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/

#include <iostream>
#warning check the output
using namespace std;
inline void solve()
{
    int n;
    cin>>n;
    int x[n],y[n];
    for (auto& i:x)
        cin>>i;
    for (auto& i:y)
        cin>>i;
   int ans=0;
   int j=n-2;
   for (int i=n-1;i>=0;i--)
   {
        while (j>=i)
            j--;
        while (y[i]&&j>=0)
        {
            int z=min(x[j],y[i]);
            y[i]-=z;
            x[j]-=z;
            ans+=z;
            if (x[j]==0)
                j--;
        }
   }
   for (int i=0;i<n;i++)
   {
        int z=min(y[i],x[i]);
        ans-=(y[i]-z);
   }
   cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t=1;
    for (int i=1;i<=t;i++)
    {
        solve();
    }
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp:8:2: warning: #warning check the output [-Wcpp]
    8 | #warning check the output
      |  ^~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…