QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#872388 | #8588. Amusement Park | Ziqt7PhR | 0 | 13ms | 6508kb | C++20 | 930b | 2025-01-26 01:12:08 | 2025-01-26 01:12:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, s;
cin >> n >> s;
vector<pair<int, int>> students;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < s; ++j) {
int h;
cin >> h;
students.emplace_back(h, i);
}
}
ranges::sort(students);
vector<int> cnt(n);
int r = 0, zero_cnt = n, ans = 1e9;
for (int l = 0; l < n * s; ++l) {
while (r < n * s && zero_cnt) {
if (cnt[students[r].second]++ == 0) {
--zero_cnt;
}
++r;
}
if (zero_cnt == 0) {
ans = min(ans, students[r - 1].first - students[l].first);
}
if (--cnt[students[l].second] == 0) {
++zero_cnt;
}
}
cout << ans << '\n';
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3456kb
input:
7 1 2 0 1 6 0 1 6 1 3 5 2 2 1 3 0 3 123456789012
output:
6
result:
wrong answer 1st lines differ - expected: '2', found: '6'
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 13ms
memory: 6508kb
input:
200000 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0...
output:
1
result:
wrong answer 1st lines differ - expected: '199999', found: '1'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%