Submission #567021

# Submission time Handle Problem Language Result Execution time Memory
567021 2022-05-23T07:21:28 Z Dodo Kitchen (BOI19_kitchen) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define pb push_back

using namespace std;
const ll mx=1007, INF=1e18L+5;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  ll n,m,k;
  cin>>n>>m>>k;
  ll arr[n];
  for(int i=0;i<n;i++)cin>>arr[i];
  deque<ll>dq(m);
  ll sum=0;
  for(int i=0;i<m;i++)
  {
    cin>>dq[i];
    sum+=dq[i];
  }
  for(int i=0;i<n;i++)
  {
    ll s=arr[i];
    while(arr[i]!=0)
    {
      if(dq.size()==0)
      {
        cout<<"Impossible";
        return 0;
      }
      ll x=dq.front();
      if(arr[i]>=x)
      {
        arr[i]-=x;
        dq.pop_front();
      }
      else
      {
        dq[0]-=arr[i];
        arr[i]=0;
      }
    }
    sum-=s;
  }
  cout<<sum;
 return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -