fix some bugs
This commit is contained in:
18
src/main.cpp
18
src/main.cpp
@ -308,7 +308,7 @@ inline void Submit(char problem_name, char *team_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void FlushScoreBoard() {
|
void FlushScoreBoard(bool show_info=true) {
|
||||||
score_board.clear();
|
score_board.clear();
|
||||||
for (int i = 1; i <= team_number; i++) {
|
for (int i = 1; i <= team_number; i++) {
|
||||||
int score = 0, penalty = 0;
|
int score = 0, penalty = 0;
|
||||||
@ -325,7 +325,7 @@ void FlushScoreBoard() {
|
|||||||
for (auto it = score_board.begin(); it != score_board.end(); ++it) {
|
for (auto it = score_board.begin(); it != score_board.end(); ++it) {
|
||||||
team_data[it->tid].rank = ++cnt;
|
team_data[it->tid].rank = ++cnt;
|
||||||
}
|
}
|
||||||
write("[Info]Flush scoreboard.\n");
|
if(show_info) write("[Info]Flush scoreboard.\n");
|
||||||
}
|
}
|
||||||
void FreezeScoreBoard() {
|
void FreezeScoreBoard() {
|
||||||
if (competition_status == kBlocked) {
|
if (competition_status == kBlocked) {
|
||||||
@ -369,15 +369,21 @@ void ScrollScoreBoard() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
write("[Info]Scroll scoreboard.\n");
|
write("[Info]Scroll scoreboard.\n");
|
||||||
|
FlushScoreBoard(false);
|
||||||
PrintScoreBoard();
|
PrintScoreBoard();
|
||||||
auto it = score_board.end();
|
auto it = score_board.end();
|
||||||
--it;
|
--it;
|
||||||
while (true) {
|
while (true) {
|
||||||
auto nxt = it;
|
auto nxt = it;
|
||||||
|
bool is_first = false;
|
||||||
|
bool frozen_found = false;
|
||||||
|
if (it == score_board.begin()) is_first = true;
|
||||||
--nxt;
|
--nxt;
|
||||||
auto nval = *nxt;
|
auto nval = *nxt;
|
||||||
|
// fprintf(stderr,"%d\n",it->tid);
|
||||||
for (int i = 0; i < total_number_of_problems; i++) {
|
for (int i = 0; i < total_number_of_problems; i++) {
|
||||||
if (team_data[it->tid].is_frozen[i]) {
|
if (team_data[it->tid].is_frozen[i]) {
|
||||||
|
frozen_found = true;
|
||||||
team_data[it->tid].is_frozen[i] = false;
|
team_data[it->tid].is_frozen[i] = false;
|
||||||
team_data[it->tid].already_passed_before_block[i] =
|
team_data[it->tid].already_passed_before_block[i] =
|
||||||
team_data[it->tid].already_passed[i];
|
team_data[it->tid].already_passed[i];
|
||||||
@ -393,16 +399,18 @@ void ScrollScoreBoard() {
|
|||||||
score_board.erase(it);
|
score_board.erase(it);
|
||||||
score_board.insert(ScoreBoredElementType(it->tid, score, penalty));
|
score_board.insert(ScoreBoredElementType(it->tid, score, penalty));
|
||||||
}
|
}
|
||||||
it=score_board.find(nval);
|
it = score_board.find(nval);
|
||||||
if(it==score_board.end()) goto finish_scroll;
|
if (it == score_board.end()) goto finish_scroll;
|
||||||
goto next_round;
|
goto next_round;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it = nxt;
|
it = nxt;
|
||||||
next_round:;
|
next_round:;
|
||||||
|
if (is_first && !frozen_found) break;
|
||||||
}
|
}
|
||||||
finish_scroll:;
|
finish_scroll:;
|
||||||
competition_status = kNormalRunning;
|
competition_status = kNormalRunning;
|
||||||
|
FlushScoreBoard(false);
|
||||||
PrintScoreBoard();
|
PrintScoreBoard();
|
||||||
}
|
}
|
||||||
void QueryRanking(char *team_name) {
|
void QueryRanking(char *team_name) {
|
||||||
|
Reference in New Issue
Block a user