2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-11-01 20:44:08 +08:00
|
|
|
#include "ojproblemset.h"
|
|
|
|
|
|
|
|
#include <QUuid>
|
|
|
|
|
2022-12-16 18:27:10 +08:00
|
|
|
OJProblemCase::OJProblemCase():
|
|
|
|
testState(ProblemCaseTestState::NotTested),
|
|
|
|
firstDiffLine(-1),
|
|
|
|
outputLineCounts(0),
|
|
|
|
expectedLineCounts(0)
|
2021-11-01 20:44:08 +08:00
|
|
|
{
|
|
|
|
QUuid uid = QUuid::createUuid();
|
|
|
|
id = uid.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &OJProblemCase::getId() const
|
|
|
|
{
|
|
|
|
return id;
|
|
|
|
}
|
2022-12-13 08:49:20 +08:00
|
|
|
|
|
|
|
size_t OJProblem::getTimeLimit()
|
|
|
|
{
|
|
|
|
switch(timeLimitUnit) {
|
|
|
|
case ProblemTimeLimitUnit::Seconds:
|
|
|
|
return timeLimit*1000;
|
|
|
|
default:
|
|
|
|
return timeLimit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t OJProblem::getMemoryLimit()
|
|
|
|
{
|
|
|
|
switch(memoryLimitUnit) {
|
|
|
|
case ProblemMemoryLimitUnit::KB:
|
|
|
|
return memoryLimit*1024;
|
|
|
|
case ProblemMemoryLimitUnit::MB:
|
|
|
|
return memoryLimit*1024*1024;
|
|
|
|
default:
|
|
|
|
return memoryLimit*1024*1024*1024;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OJProblem::OJProblem() :
|
|
|
|
timeLimit(0),
|
|
|
|
memoryLimit(0),
|
2022-12-24 12:08:13 +08:00
|
|
|
timeLimitUnit(ProblemTimeLimitUnit::Seconds),
|
2022-12-13 08:49:20 +08:00
|
|
|
memoryLimitUnit(ProblemMemoryLimitUnit::MB)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|