Skip to content
Merged
7 changes: 7 additions & 0 deletions src/base/LemonUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ namespace Lemon::detail {
} else
return -1;
}
inline long long jsonReadHelper(long long &val, const QJsonValue &jval) {
if (jval.isDouble()) {
val = jval.toInteger();
return 0;
} else
return -1;
}
inline int jsonReadHelper(bool &val, const QJsonValue &jval) {
if (jval.isBool()) {
val = jval.toBool();
Expand Down
4 changes: 2 additions & 2 deletions src/component/exportutil/exportutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant,
QList<QList<ResultState>> result = contestant->getResult(i);
QList<QStringList> message = contestant->getMessage(i);
QList<QList<int>> timeUsed = contestant->getTimeUsed(i);
QList<QList<int>> memoryUsed = contestant->getMemoryUsed(i);
QList<QList<long long>> memoryUsed = contestant->getMemoryUsed(i);
Comment thread
ZnPdCo marked this conversation as resolved.
Outdated
QList<QList<int>> score = contestant->getScore(i);

for (int j = 0; j < inputFiles.size(); j++) {
Expand Down Expand Up @@ -493,7 +493,7 @@ auto ExportUtil::getSmallerContestantHtmlCode(Contest *contest, Contestant *cont
QList<QList<ResultState>> result = contestant->getResult(i);
QList<QStringList> message = contestant->getMessage(i);
QList<QList<int>> timeUsed = contestant->getTimeUsed(i);
QList<QList<int>> memoryUsed = contestant->getMemoryUsed(i);
QList<QList<long long>> memoryUsed = contestant->getMemoryUsed(i);
QList<QList<int>> score = contestant->getScore(i);

for (int j = 0; j < inputFiles.size(); j++) {
Expand Down
8 changes: 5 additions & 3 deletions src/core/contestant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ auto Contestant::getScore(int index) const -> const QList<QList<int>> & { return

auto Contestant::getTimeUsed(int index) const -> const QList<QList<int>> & { return timeUsed[index]; }

auto Contestant::getMemoryUsed(int index) const -> const QList<QList<int>> & { return memoryUsed[index]; }
auto Contestant::getMemoryUsed(int index) const -> const QList<QList<long long>> & {
return memoryUsed[index];
}

auto Contestant::getJudingTime() const -> QDateTime { return judgingTime; }

Expand All @@ -60,7 +62,7 @@ void Contestant::setScore(int index, const QList<QList<int>> &_score) { score[in

void Contestant::setTimeUsed(int index, const QList<QList<int>> &_timeUsed) { timeUsed[index] = _timeUsed; }

void Contestant::setMemoryUsed(int index, const QList<QList<int>> &_memoryUsed) {
void Contestant::setMemoryUsed(int index, const QList<QList<long long>> &_memoryUsed) {
memoryUsed[index] = _memoryUsed;
}

Expand All @@ -76,7 +78,7 @@ void Contestant::addTask() {
message.append(QList<QStringList>());
score.append(QList<QList<int>>());
timeUsed.append(QList<QList<int>>());
memoryUsed.append(QList<QList<int>>());
memoryUsed.append(QList<QList<long long>>());
}

void Contestant::deleteTask(int index) {
Expand Down
6 changes: 3 additions & 3 deletions src/core/contestant.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Contestant : public QObject {
const QList<QStringList> &getMessage(int) const;
const QList<QList<int>> &getScore(int) const;
const QList<QList<int>> &getTimeUsed(int) const;
const QList<QList<int>> &getMemoryUsed(int) const;
const QList<QList<long long>> &getMemoryUsed(int) const;
QDateTime getJudingTime() const;
int getTaskScore(int) const;
int getTotalScore() const;
Expand All @@ -46,7 +46,7 @@ class Contestant : public QObject {
void setMessage(int, const QList<QStringList> &);
void setScore(int, const QList<QList<int>> &);
void setTimeUsed(int, const QList<QList<int>> &);
void setMemoryUsed(int, const QList<QList<int>> &);
void setMemoryUsed(int, const QList<QList<long long>> &);
void setJudgingTime(QDateTime);

int writeToJson(QJsonObject &);
Expand All @@ -64,7 +64,7 @@ class Contestant : public QObject {
QList<QList<QStringList>> message;
QList<QList<QList<int>>> score;
QList<QList<QList<int>>> timeUsed;
QList<QList<QList<int>>> memoryUsed;
QList<QList<QList<long long>>> memoryUsed;
QDateTime judgingTime;

// QList<TaskResult> taskResults;
Expand Down
4 changes: 2 additions & 2 deletions src/core/judgingthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void JudgingThread::setInterpreterAsWatcher(bool use) { interpreterAsWatcher = u

auto JudgingThread::getTimeUsed() const -> int { return timeUsed; }

auto JudgingThread::getMemoryUsed() const -> int { return memoryUsed; }
auto JudgingThread::getMemoryUsed() const -> long long { return memoryUsed; }

auto JudgingThread::getScore() const -> int { return score; }

Expand Down Expand Up @@ -924,7 +924,7 @@ void JudgingThread::runProgram() {
if (memoryLimit != -1) {
GetProcessMemoryInfo(pi.hProcess, (PROCESS_MEMORY_COUNTERS *)&memoryInfo, sizeof(memoryInfo));

if (qMax(memoryInfo.PrivateUsage, memoryInfo.PeakWorkingSetSize) > memoryLimit * 1024 * 1024) {
if (qMax(memoryInfo.PrivateUsage, memoryInfo.PeakWorkingSetSize) > 1ll * memoryLimit * 1024 * 1024) {
TerminateProcess(pi.hProcess, 0);

score = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/core/judgingthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class JudgingThread : public QThread {
void setRawMemoryLimit(int);
void setInterpreterAsWatcher(bool);
int getTimeUsed() const;
int getMemoryUsed() const;
long long getMemoryUsed() const;
int getScore() const;
int getFullScore() const;
int getJudgeTimes() const;
Expand Down Expand Up @@ -70,7 +70,7 @@ class JudgingThread : public QThread {
int memoryLimit{};
int rawMemoryLimit{};
int timeUsed;
int memoryUsed;
long long memoryUsed;
int score{};
int judgedTimes;
ResultState result;
Expand Down
2 changes: 1 addition & 1 deletion src/core/taskjudger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ int TaskJudger::judge() {

for (int i = 0; i < task->getTestCaseList().size(); i++) {
timeUsed.append(QList<int>());
memoryUsed.append(QList<int>());
memoryUsed.append(QList<long long>());
score.append(QList<int>());
result.append(QList<ResultState>());
overallStatus.append(maxDependValue);
Expand Down
2 changes: 1 addition & 1 deletion src/core/taskjudger.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class TaskJudger : public QObject {
QProcessEnvironment environment;
QList<int> overallStatus;
QList<QList<int>> timeUsed;
QList<QList<int>> memoryUsed;
QList<QList<long long>> memoryUsed;
QList<QList<int>> score;
QList<QList<ResultState>> result;
QList<QStringList> message;
Expand Down
2 changes: 1 addition & 1 deletion src/detaildialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void DetailDialog::refreshViewer(Contest *_contest, Contestant *_contestant) {
QList<QList<ResultState>> result = contestant->getResult(i);
QList<QStringList> message = contestant->getMessage(i);
QList<QList<int>> timeUsed = contestant->getTimeUsed(i);
QList<QList<int>> memoryUsed = contestant->getMemoryUsed(i);
QList<QList<long long>> memoryUsed = contestant->getMemoryUsed(i);
QList<QList<int>> score = contestant->getScore(i);

for (int j = 0; j < inputFiles.size(); j++) {
Expand Down
2 changes: 1 addition & 1 deletion src/judgingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void JudgingDialog::judgeAll() {
}

void JudgingDialog::singleCaseFinished(QString contestantName, int progress, int x, int y, int result,
int scoreGot, int timeUsed, int memoryUsed) {
int scoreGot, int timeUsed, long long memoryUsed) {
bool isOnMaxValue =
ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum();
QTextBlockFormat blockFormat;
Expand Down
2 changes: 1 addition & 1 deletion src/judgingdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class JudgingDialog : public QDialog {

public slots:
void dialogAlert(const QString &);
void singleCaseFinished(QString, int, int, int, int, int, int, int);
void singleCaseFinished(QString, int, int, int, int, int, int, long long);
void singleSubtaskDependenceFinished(int, int, int);
void taskJudgingStarted(const QString &);
void taskJudgedDisplay(const QString &, const QList<QList<int>> &, const int);
Expand Down
Loading