Question: Could you please help identify what is wrong with my code? The output is not as instructed and I am stuck on this question. Thank

Could you please help identify what is wrong with my code? The output is not as instructed and I am stuck on this question. Thank you.

#include

using namespace std;

int main()

{

int n;

cin>>n;

int t[n],k[n],a[n][300005],nationality[300005]={0};

int z=0,j=0;

for(int i=0;i

{

cin>>t[i];

cin>>k[i];

for(int j=0;j

{

cin>>a[i][j];

nationality[a[i][j]-1]++;

}

while(t[i]-t[j]>=86400)

{

for(int x=0;x

{

nationality[a[j][x]-1]--;

}

j++;

}

int count=0;

for(int z=0;z

{

if(nationality[z]>0)

{

count++;

}

}

cout

}

return 0;

}

Could you please help identify what is wrong with my code? Theoutput is not as instructed and I am stuck on this question.
Description Victoria Harbour in Hong Kong has many busy ports and piers for all kinds of usage. For example, Kai Tak Cruise Terminal always welcomes large cruises with people from around the world. As a customs officer working in Kai Tak Cruise Terminal, Kyaru needs to record the information of all the cruises arrived and the passengers they carry. Specifically, for the ith arrived cruise, she records it- as the time it arrived, kg as the number of passengers on board, and :15le S j S 143,-) as the nationality of each passengers. One day, she was asked that for each of the cruises, she needs to count the number of different nationalities of all the passengers passing the customs within 24 hours(86400 seconds) before its arrival (include passengers on itself) (the time gap between one's cruise arriving at the terminal and him passing the customs is ignored). Since there're too many records on her hand, she turned to you for help. Formally, you need to check 11 records. For the ith record, you should count the number of different numbers appeared among all mpg fulfilling ti 86400

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!