Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8356385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:10:54+00:00 2026-06-09T10:10:54+00:00

I am trying to solve the stopping postman problem, but I’m not able to

  • 0

I am trying to solve the stopping postman problem, but I’m not able to find any algorithm to solve it. The problem is this:

There are n houses numbered 1 to n, and n postman, each having n
letters to be posted in each house. The postmaster has decided a plan
such that each postman visits each house exactly once at a different
time, i.e. there is at most one postman in any house at any time.
Since no postman like any other , postmaster wants that no postmaster
meet any other during delivery of posts to n houses. So he wants a
postman to stop posting after a particular house. That is, Postmaster
wants to find a sequence stop such that the i-th postman will
stop posting after stop[i]-th house once he visits that house. As
he wants to ensure that there is at maximum one post in each house, he
must choose the sequence stop such that if postman A visits house
H at time T, and he stops posting after the house, then no other
postman visit house H after time T. Help postmaster to find such a
sequence stop.

The input is given as follows:

Firstly n (1 ≤ n ≤ 100), indicating the number of postman and houses. Then n lines follow, with each line containing n positive integers. The j-th integer in i-th line indicates the time when the i-th postman will visit the j-th house.

Example:
n = 3

The sequence is :

1 2 3

4 5 6

7 8 9

The outputted stop array should be:

3 2 1, i.e. 1st postman stops posting in 3rd house, 2nd in 2nd house and 3rd in first house.

What algorithm should I use to solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:10:55+00:00Added an answer on June 9, 2026 at 10:10 am

    Update, my last answer was wrong.

    New solution:
    on each step find min number in each row, then take the max of them and that will be the stop for i-th postman. on each next step don’t consider that postman anymore

    For the sample you provided:

    1 2 3 
    4 5 6 
    7 8 9
    

    1st step we find 1 4 7, maximum of them is 7 so for the 3rd postman stop is at 1st house(stop[3] = 1)
    after that we don’t consider 1st column and 3rd row
    2nd step we find 2 and 5, max is 5 so – stop[2] = 2;
    3rd step stop[1] = 3;

    So, why is it true, if we selected the right number on some step we know that for any number in the same column, it’s either less than our number (that means it won’t cause problem later) or bigger that our number, but that row has the number which is less than it WILL be selected later, so that that the bigger number in our column won’t be used

    And for the example @Wayne Rooney provided

    1 4 2
    8 6 9
    5 7 3
    

    1st step find 1, 6, 3, select 6
    2nd step find 1, 3 select 3
    3rd step 1
    answer: 1, 2, 3

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to solve this xcode problem since 2 weeks and didn't find any solutions
Trying to solve this problem . I would like to learn how the bootstrapper
I am trying to solve this problem http://www.spoj.pl/problems/PEBBMOV/ . I think I have the
I have been trying to solve this problem all day, I googled a lot,
When trying to solve this problem , I encountered some articles, etc. referring to
I’ve been trying to solve this problem for a while now to no avail.
I have been trying to solve this problem for three days now, it's really
Trying to solve this problem: I have the following set of divs that when
I'm trying to solve this problem where I have a unique array of values
I'm trying to solve a problem which asks to find all squares of 1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.