Task: | Peli |
Sender: | Niilo |
Submission time: | 2024-05-12 23:17:58 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#3 | WRONG ANSWER | 0.48 s | 2 | details |
#4 | WRONG ANSWER | 0.00 s | 1, 2 | details |
#5 | ACCEPTED | 0.00 s | 1, 2 | details |
#6 | WRONG ANSWER | 0.48 s | 2 | details |
#7 | ACCEPTED | 0.65 s | 2 | details |
#8 | ACCEPTED | 0.01 s | 1, 2 | details |
#9 | TIME LIMIT EXCEEDED | -- | 2 | details |
#10 | TIME LIMIT EXCEEDED | -- | 2 | details |
Code
#include <bits/stdc++.h> using namespace std; using ll = int64_t; const int N = 2500; int n, m, q; vector<int> V[N]; pair<int,int> D[N][N]; priority_queue<pair<int,int>> Q; int main() { cin >> n >> m >> q; for (int i=0; i < m; ++i) { int a, b; cin >> a >> b; V[a-1].push_back(b-1); V[b-1].push_back(a-1); } for (int i=0; i < n; ++i) { Q.push({0,i}); D[i][i] = {0,2}; while (Q.size()) { auto [s,j] = Q.top(); Q.pop(); s = -s + 1; for (int k : V[j]) { auto& [p1,p2] = D[i][k]; if (s % 2 == 1 && !p1) { p1 = s; Q.push({-s,k}); } else if (s % 2 == 0 && !p2) { p2 = s; Q.push({-s,k}); } } } } for (int i=0; i < q; ++i) { int a, b, x; cin >> a >> b >> x; --a; --b; if ((x % 2 == 1 && D[a][b].first <= x) || (x % 2 == 0 && D[a][b].second <= x) || (a == b && x == 0)) { cout << "YES\n"; } else { cout << "NO\n"; } } }
Test details
Test 1
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
2 1 100 1 2 1 1 0 1 2 0 2 1 0 ... |
correct output |
---|
YES NO NO YES NO ... |
user output |
---|
YES YES YES YES YES ... Truncated |
Test 2
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
50 49 100 33 34 7 8 49 50 47 48 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
YES YES YES YES YES ... Truncated |
Test 3
Group: 2
Verdict: WRONG ANSWER
input |
---|
2500 2499 100000 821 822 2351 2352 752 753 832 833 ... |
correct output |
---|
NO YES YES NO NO ... |
user output |
---|
YES YES YES YES YES ... Truncated |
Test 4
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
12 12 100 9 10 2 3 1 12 1 2 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
YES YES YES YES YES ... Truncated |
Test 5
Group: 1, 2
Verdict: ACCEPTED
input |
---|
11 11 100 10 11 7 8 1 2 5 6 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
YES YES YES YES YES ... Truncated |
Test 6
Group: 2
Verdict: WRONG ANSWER
input |
---|
2500 2500 100000 1936 1937 1884 1885 751 752 831 832 ... |
correct output |
---|
NO YES YES NO NO ... |
user output |
---|
YES YES YES YES YES ... Truncated |
Test 7
Group: 2
Verdict: ACCEPTED
input |
---|
2499 2499 100000 821 822 2351 2352 752 753 832 833 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
YES YES YES YES YES ... Truncated |
Test 8
Group: 1, 2
Verdict: ACCEPTED
input |
---|
50 99 100 40 47 34 50 44 47 15 16 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
YES YES YES YES YES ... Truncated |
Test 9
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
2500 4999 100000 1191 2361 251 399 1026 2300 82 1655 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
(empty) |
Test 10
Group: 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
2500 4999 100000 2023 2218 23 51 1020 1272 11 114 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
(empty) |