Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

部分实现#341 #476

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions record.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,23 @@ def distance(A, B, inf=2147483647):
return inf
if abs(a.gender - b.gender) == 2:
return inf

if abs(a.contest.school_year() - b.contest.school_year()) == 1 and a.grades==65536 and b.grades==524288:
return inf
# 如果存在第一年初一,第二年直升高一的情况,不合并

if (a.grades in [65536,262144,131072] and b.grades in [65536,262144,131072] or a.grades in [524288,1048576,2097152] and b.grades in [524288,1048576,2097152]) and a.province != b.province:
return inf
# 在同一学段内出现跨省获奖的情况,不合并

if a.contest.school_year == b.contest.school_year and a.school != b.school:
return inf
# 在同一学年中出现就读学校不一致、年级不一致的情况,不合并

if a.grades in [4290837504,64512,32768,16384,8192] and b.grades in [4290837504,64512,32768,16384,8192] and a.school != b.school:
return inf
# 如果处于小学阶段且就读学校不一致,不合并

if a.contest.school_year() == b.contest.school_year():
if len(set(a.ems) & set(b.ems)) == 0:
return inf
Expand Down