#include<bits/stdc++.h>
using namespace std;
int main()
{
int t, n, i, j = 1;
cin >> t;
while(t--)
{
cin >> n;
int a[n], b[n], sum = 0, baki = 0, index = -1;
for(i=0;i<n;i++)
cin >> a[i];
for(i=0;i<n;i++)
cin >> b[i];
for(i=0;i<n;i++)
{
sum += a[i];
if(sum >= b[i])
sum -= b[i];
else
{
index = i;
baki += (b[i]-sum);
sum = 0;
}
}
if(baki > sum)
cout << "Case " << j++ << ": " << "Not possible" << "\n";
else
cout << "Case " << j++ << ": " << "Possible from station " << index+2 << "\n";
}
return 0;
}
Comments
Post a Comment