Created
October 2, 2013 13:06
-
-
Save hirokazumiyaji/6793435 to your computer and use it in GitHub Desktop.
PERSON_DAILY: {Date: [PersonID, PersonID]} 指定期間中に人は会議に2回参加しなければならない。
同じ日には2度参加できない。
1回目の参加日は下記(PERSON_DAILY)で決まっており、
2回目移行は自動で割り振られる。
自動で割り振る際に日による人数の偏りをできるだけ無くすようにする
アルゴリズムを考えよ。
1日による参加人数は偶数になること。
現在の状況は下記のshowの結果があります。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
PERSON_DAILY: {Date: [PersonID, PersonID]} | |
指定期間中に人は会議に2回参加しなければならない。 | |
同じ日には2度参加できない。 | |
1回目の参加日は下記(PERSON_DAILY)で決まっており、 | |
2回目移行は自動で割り振られる。 | |
自動で割り振る際に日による人数の偏りをできるだけ無くすようにする | |
アルゴリズムを考えよ。 | |
1日による参加人数は偶数になること。 | |
現在の状況は下記のshowの結果があります。 | |
""" | |
PERSON_DAILY = { | |
"10/02": [ | |
"00001", | |
"00007", | |
"00010", | |
"00011", | |
"00013", | |
"00033", | |
"00039", | |
"00043", | |
"00048", | |
"00051", | |
"00059", | |
"00060", | |
"00066", | |
"00068", | |
"00070", | |
"00081", | |
"00083", | |
"00109", | |
"00119", | |
"00121", | |
"00122", | |
"00133", | |
"00143", | |
"00153", | |
"00162", | |
"00175", | |
"00179", | |
"00191" | |
], | |
"10/03": [ | |
"00003", | |
"00009", | |
"00015", | |
"00019", | |
"00021", | |
"00023", | |
"00049", | |
"00055", | |
"00061", | |
"00073", | |
"00079", | |
"00098", | |
"00108", | |
"00115", | |
"00118", | |
"00125", | |
"00132", | |
"00134", | |
"00145", | |
"00147", | |
"00148", | |
"00152", | |
"00155", | |
"00163", | |
"00166", | |
"00167", | |
"00169", | |
"00172", | |
"00176", | |
"00185" | |
], | |
"10/04": [ | |
"00004", | |
"00052", | |
"00080", | |
"00082", | |
"00087", | |
"00089", | |
"00091", | |
"00093", | |
"00094", | |
"00106", | |
"00111", | |
"00113", | |
"00123", | |
"00124", | |
"00136", | |
"00137", | |
"00140", | |
"00141", | |
"00154", | |
"00160", | |
"00181", | |
"00192", | |
"00194", | |
"00197", | |
"00198", | |
"00187", | |
"00196" | |
], | |
"10/05": [ | |
"00016", | |
"00026", | |
"00036", | |
"00057", | |
"00069", | |
"00071", | |
"00074", | |
"00084", | |
"00092", | |
"00095", | |
"00097", | |
"00100", | |
"00104", | |
"00110", | |
"00138", | |
"00151", | |
"00173", | |
"00184", | |
"00188" | |
], | |
"10/06": [ | |
"00005", | |
"00008", | |
"00012", | |
"00014", | |
"00017", | |
"00028", | |
"00031", | |
"00034", | |
"00041", | |
"00042", | |
"00044", | |
"00050", | |
"00056", | |
"00058", | |
"00064", | |
"00065", | |
"00067", | |
"00072", | |
"00085", | |
"00086", | |
"00099", | |
"00101", | |
"00102", | |
"00105", | |
"00107", | |
"00116", | |
"00117", | |
"00139", | |
"00144", | |
"00156", | |
"00157", | |
"00164", | |
"00171", | |
"00180", | |
"00183", | |
"00190", | |
"00193", | |
"00200", | |
"00195", | |
"00189" | |
], | |
"10/07": [ | |
"00006", | |
"00018", | |
"00024", | |
"00025", | |
"00035", | |
"00037", | |
"00045", | |
"00053", | |
"00063", | |
"00076", | |
"00088", | |
"00090", | |
"00096", | |
"00114", | |
"00126", | |
"00131", | |
"00146", | |
"00149", | |
"00165", | |
"00174", | |
"00177", | |
"00178", | |
"00182", | |
"00186" | |
], | |
"10/08": [ | |
"00002", | |
"00020", | |
"00022", | |
"00027", | |
"00029", | |
"00030", | |
"00032", | |
"00038", | |
"00040", | |
"00046", | |
"00047", | |
"00054", | |
"00062", | |
"00075", | |
"00077", | |
"00078", | |
"00103", | |
"00112", | |
"00120", | |
"00127", | |
"00128", | |
"00129", | |
"00130", | |
"00135", | |
"00142", | |
"00150", | |
"00158", | |
"00159", | |
"00161", | |
"00168", | |
"00170", | |
"00199" | |
] | |
} | |
def show(person_daily): | |
for date, person in sorted(person_in_date.items(), key=lambda x: x[0]): | |
print '{}:{}'.format(date, '#' * len(person)) | |
""" | |
>>>show(person_daily) | |
10/02:############################ | |
10/03:############################## | |
10/04:########################### | |
10/05:################### | |
10/06:######################################## | |
10/07:######################## | |
10/08:################################ | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment