Task: | Ryhmät |
Sender: | Metabolix |
Submission time: | 2025-09-26 23:54:17 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#3 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#4 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#5 | ACCEPTED | 0.00 s | 1, 2, 3 | details |
#6 | ACCEPTED | 0.08 s | 2 | details |
#7 | WRONG ANSWER | 0.04 s | 2 | details |
#8 | ACCEPTED | 0.20 s | 2 | details |
#9 | ACCEPTED | 0.03 s | 2, 3 | details |
#10 | WRONG ANSWER | 0.88 s | 3 | details |
#11 | WRONG ANSWER | 0.42 s | 3 | details |
#12 | WRONG ANSWER | 0.25 s | 3 | details |
#13 | TIME LIMIT EXCEEDED | -- | 3 | details |
#14 | TIME LIMIT EXCEEDED | -- | 3 | details |
#15 | ACCEPTED | 0.79 s | 3 | details |
#16 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
#include <iostream> #include <queue> #include <vector> #include <map> #include <algorithm> using namespace std; int main() { int n, t; cin >> n >> t; vector<pair<int, int>> toiveet(n); vector<pair<int, int>> toiveet_rev(n); for (int i = 0; i < n; i++) { cin >> toiveet[i].first >> toiveet[i].second; toiveet_rev[i] = {toiveet[i].second, toiveet[i].first}; } sort(toiveet.begin(), toiveet.end()); sort(toiveet_rev.begin(), toiveet_rev.end()); vector<int> toiveet_delta(n + 1); for (auto &[alku, loppu] : toiveet) { toiveet_delta[alku]++; toiveet_delta[loppu + 1]--; } vector<int> toiveet_maksimi(n + 1); toiveet_maksimi[0] = toiveet_delta[0]; for (int i = 0; i <= n; i++) { toiveet_maksimi[i] = toiveet_maksimi[i - 1] + toiveet_delta[i]; } for (int _ = 0; _ < t; _++) { if (0) { ei:; cout << "NO\n"; continue; } int ryhmien_maara; cin >> ryhmien_maara; map<int, int> ryhmät; for (int i = 0; i < ryhmien_maara; i++) { int ryhmän_koko; cin >> ryhmän_koko; ryhmät[ryhmän_koko] += ryhmän_koko; if (ryhmät[ryhmän_koko] > toiveet_maksimi[ryhmän_koko]) { // Liian monta lasta, joilla on sama ryhmän koko goto ei; } } priority_queue<int> toiveet_alkaneet; int toive_i = 0; for (auto &[koko, lapsimäärä] : ryhmät) { while (!toiveet_alkaneet.empty() && -toiveet_alkaneet.top() < koko) { toiveet_alkaneet.pop(); } while (toive_i < n && toiveet[toive_i].first <= koko) { toiveet_alkaneet.push(-toiveet[toive_i].second); toive_i++; } while (!toiveet_alkaneet.empty() && -toiveet_alkaneet.top() < koko) { toiveet_alkaneet.pop(); } for (int lapsi = 0; lapsi < lapsimäärä; lapsi++) { if (toiveet_alkaneet.empty()) { goto ei; } else { toiveet_alkaneet.pop(); } } } cout << "YES\n"; } }
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
100 100 10 10 10 10 6 9 6 8 ... |
correct output |
---|
YES YES YES NO YES ... |
user output |
---|
YES YES YES NO YES ... |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
100 100 9 9 6 10 8 10 8 8 ... |
correct output |
---|
NO YES NO YES NO ... |
user output |
---|
NO YES NO YES YES ... |
Test 3
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
100 100 1 1 1 1 1 1 1 1 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
YES YES YES YES YES ... |
Test 4
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
100 100 100 100 100 100 100 100 100 100 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
YES YES YES YES YES ... |
Test 5
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
100 100 4 9 3 8 7 9 7 9 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
NO NO NO NO NO ... |
Test 6
Group: 2
Verdict: ACCEPTED
input |
---|
1000 1000 9 10 2 5 10 10 5 5 ... |
correct output |
---|
YES YES YES YES NO ... |
user output |
---|
YES YES YES YES NO ... |
Test 7
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 1000 5 7 9 9 3 7 8 10 ... |
correct output |
---|
YES NO NO YES YES ... |
user output |
---|
YES NO NO YES YES ... |
Test 8
Group: 2
Verdict: ACCEPTED
input |
---|
1000 1000 1 1 1 1 1 1 1 1 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
YES YES YES YES YES ... |
Test 9
Group: 2, 3
Verdict: ACCEPTED
input |
---|
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
YES YES YES YES YES ... |
Test 10
Group: 3
Verdict: WRONG ANSWER
input |
---|
100000 1000 774 778 363 852 309 668 261 459 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
YES YES YES YES YES ... |
Test 11
Group: 3
Verdict: WRONG ANSWER
input |
---|
100000 1000 1233 1914 901 3963 1277 4293 1083 1599 ... |
correct output |
---|
NO NO YES NO NO ... |
user output |
---|
NO NO NO NO NO ... |
Test 12
Group: 3
Verdict: WRONG ANSWER
input |
---|
100000 1000 1970 8631 4606 5797 6317 8162 8204 8789 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
NO NO NO NO NO ... |
Test 13
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
(empty) |
Test 14
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 100000 1 100000 1 100000 1 100000 1 100000 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
(empty) |
Test 15
Group: 3
Verdict: ACCEPTED
input |
---|
100000 100000 80971 98445 93046 96043 74840 94035 95931 96609 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
NO NO NO NO NO ... |
Test 16
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 10000 6481 14350 69129 87600 6217 16462 4387 16625 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
(empty) |