Submission #567195

# Submission time Handle Problem Language Result Execution time Memory
567195 2022-05-23T09:07:06 Z Dodo Kitchen (BOI19_kitchen) C++14
0 / 100
1 ms 340 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 sum=0;
  for(int i=0;i<n;i++)
  {
    ll x;
    cin>>x;
    sum+=x;
  }
  vector<ll>v;
  ll arr[m];
  for(int i=0;i<m;i++)
  {
    ll x;
    cin>>x;
    arr[i]=x;
    v.push_back(x);
  }
  sort(arr,arr+m);

  for(int i=1;i<m;i++)
  {
    arr[i]+=arr[i-1];
  }

  for(int i=1;i<m;i++)
  {
    for(int j=0;j<m;j++)
    {
      if(j+i>=m)break;
      ll x=arr[i+j];
      if(j>0)x-=arr[j-1];
      if(x>=sum)v.push_back(x);
    }
  }
  sort(v.begin(),v.end());
  ll u=lower_bound(v.begin(),v.end(),sum)-v.begin();
  if(u!=v.size())
  {
    cout<<sum-v[u];
  }
  else cout<<"Impossible";
 return 0;
}

Compilation message

kitchen.cpp: In function 'int main()':
kitchen.cpp:52:7: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |   if(u!=v.size())
      |      ~^~~~~~~~~~
# 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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 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 -