Skip to content

Conversation

@ZnPdCo
Copy link
Contributor

@ZnPdCo ZnPdCo commented Feb 2, 2026

fix #281

@prostylekali 能否用您的代码测试一下,看看还有没有问题 🤔

本地使用 Windows 测试下面的代码:

#include <bits/stdc++.h>
using namespace std;
int main() {
    vector<int> c(535350912);
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
}
image

@ZnPdCo ZnPdCo marked this pull request as draft February 2, 2026 13:34
@ZnPdCo ZnPdCo marked this pull request as ready for review February 3, 2026 06:33
@ZnPdCo ZnPdCo marked this pull request as draft February 4, 2026 02:11
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接 int64_t 吧

Copy link
Contributor Author

@ZnPdCo ZnPdCo Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 qint64 吧,在 linux 下 int64_t 是 long int,qt 不知道为什么没有重载这个

@ZnPdCo
Copy link
Contributor Author

ZnPdCo commented Feb 9, 2026

if (memoryLimit != -1) {
GetProcessMemoryInfo(pi.hProcess, (PROCESS_MEMORY_COUNTERS *)&memoryInfo, sizeof(memoryInfo));
if (qMax(memoryInfo.PrivateUsage, memoryInfo.PeakWorkingSetSize) > memoryLimit * 1024 * 1024) {
TerminateProcess(pi.hProcess, 0);
score = 0;
result = MemoryLimitExceeded;
memoryUsed = timeUsed = -1;
return;
}
}
bool isProgramFinishedInExtraTimeLimit = false;
QElapsedTimer timer;
timer.start();
while (timer.elapsed() <= timeLimit + extraTime) {
if (WaitForSingleObject(pi.hProcess, 0) == WAIT_OBJECT_0) {
isProgramFinishedInExtraTimeLimit = true;
break;
}
if (memoryLimit != -1) {
GetProcessMemoryInfo(pi.hProcess, (PROCESS_MEMORY_COUNTERS *)&memoryInfo, sizeof(memoryInfo));
if (qMax(memoryInfo.PrivateUsage, memoryInfo.PeakWorkingSetSize) > memoryLimit * 1024U * 1024) {
TerminateProcess(pi.hProcess, 0);
score = 0;
result = MemoryLimitExceeded;
memoryUsed = timeUsed = -1;
return;
}
}
QCoreApplication::processEvents();
if (stopJudging || skipEnabled) {
TerminateProcess(pi.hProcess, 0);
if (skipEnabled) {
score = 0;
result = TimeLimitExceeded;
timeUsed = memoryUsed = -1;
}
return;
}
QThread::msleep(10);
}

这里怎么把同样的逻辑写了两遍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]windows 下大空间限制测评空间不准确,甚至负数

2 participants