Open
Description
Description of the problem
At GCPC, we encountered a submission where the /jury/submissions/<submitid>/source
route just showed a blank page:

The submission was judged as correct and it also has compilation metadata and output that indicates it was not an empty file:
M.cpp: In function 'bool check(std::vector<long int>&, i64)':
M.cpp:11:14: warning: comparison of integer expressions of different signedness: 'i64' {aka 'long int'} and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
11 | while (i < ids.size()) {
| ~~^~~~~~~~~~~~
M.cpp:16:18: warning: comparison of integer expressions of different signedness: 'i64' {aka 'long int'} and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | while (j < ids.size() && ids[j+1] < ids[i] + d)
| ~~^~~~~~~~~~~~
M.cpp: In function 'int main()':
M.cpp:32:9: warning: unused variable 'm' [-Wunused-variable]
32 | i64 m = 0;
| ^
Your environment
- DOMjudge version:
b32fc5c8c5a84160e6e26203228fbbe1ec8444e9
with028995f9c00e7897ec863283986ef995661e38b9
cherry-picked on top of that - Operating system / Linux distribution and version: Debian GNU/Linux 12 (bookworm), 6.1.0-27-amd64
- Webserver: nginx/1.22.1
Steps to reproduce
Not sure how to reproduce this, as this is the only time this has ever happened to us.
Expected behaviour
The actual source code of the submission should be displayed.
Actual behaviour
An empty page is displayed.
Any other information that you want to share?
The source code of the submission seems to be present in the database, so I'm not sure why it fails to display it:
MariaDB [domjudge]> select * from submission where submitid = 13616;
+----------+--------------+------+--------+--------+--------+--------+----------------------+-------+-------------+------------------+------------+-------------+--------------+
| submitid | origsubmitid | cid | teamid | userid | probid | langid | submittime | valid | rejudgingid | expected_results | externalid | entry_point | import_error |
+----------+--------------+------+--------+--------+--------+--------+----------------------+-------+-------------+------------------+------------+-------------+--------------+
| 13616 | NULL | 16 | 678 | 691 | 296 | cpp | 1751721909.516700000 | 1 | NULL | NULL | 13616 | NULL | NULL |
+----------+--------------+------+--------+--------+--------+--------+----------------------+-------+-------------+------------------+------------+-------------+--------------+
1 row in set (0.000 sec)
MariaDB [domjudge]> select * from submission_file where submitid = 13616;
+--------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------------+
| submitfileid | submitid | sourcecode | filename | ranknumber |
+--------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------------+
| 13644 | 13616 | #include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;
i64 n, d;
bool check(vector<i64>& ids, i64 D) {
// check if all Ds can be excluded
i64 earliest = 0;
i64 i = 0;
while (i < ids.size()) {
if (ids[i] < earliest)
return false;
// find all that are covered by [id,id+d-1]
i64 j = i;
while (j < ids.size() && ids[j+1] < ids[i] + d)
j++;
// find start spot
i64 start = max(earliest,ids[j]-d+1);
// update
i = j+1;
earliest = start + 2*d;
}
return true;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
i64 x;
cin >> n >> d;
vector<vector<i64>> indices(n);
i64 m = 0;
for (i64 i = 0; i < n; i++) {
cin >> x;
indices[x].push_back(i);
}
i64 D = 0;
while (D < n && !check(indices[D],D)) {
D++;
}
cout << D << "\n";
} | M.cpp | 0 |
+--------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------------+
1 row in set (0.000 sec)