Task: | Peli |
Sender: | Yamaxanadu |
Submission time: | 2024-01-20 16:49:07 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.00 s | 1, 2 | details |
#2 | ACCEPTED | 0.00 s | 1, 2 | details |
#3 | WRONG ANSWER | 0.15 s | 2 | details |
#4 | ACCEPTED | 0.00 s | 1, 2 | details |
#5 | ACCEPTED | 0.00 s | 1, 2 | details |
#6 | WRONG ANSWER | 0.18 s | 2 | details |
#7 | ACCEPTED | 0.17 s | 2 | details |
#8 | TIME LIMIT EXCEEDED | -- | 1, 2 | details |
#9 | TIME LIMIT EXCEEDED | -- | 2 | details |
#10 | TIME LIMIT EXCEEDED | -- | 2 | details |
Compiler report
input/code.cpp: In function 'void search(int, int, int, int)': input/code.cpp:19:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 19 | for(int i = 0; i < v[k].size(); i++) { | ~~^~~~~~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; vector<int> v[2501]; int target; int seven; int sodd; set<int> vis; void search(int k,int w,int y,int z) { vis.insert(k); if (sodd <= target and target%2 == 1) { } else if (seven <= target and target%2 == 0) { } else { for(int i = 0; i < v[k].size(); i++) { if (v[k][i] == w) { if (y%2 == 0) { seven = min(seven,y); } else { sodd = min(sodd,y); } } if (v[k][i] != z) { if (vis.count(v[k][i]) != 1) { search(v[k][i],w,y+1,k); } } } } vis.erase(k); } int main() { vector<int> cins; int n,m,q; int a,b,c; cin >> n >> m >> q; for(int i = 0; i<m; i++) { cin >> a >> b; v[a].push_back(b); v[b].push_back(a); } cout << "\n"; for(int i = 0; i<3*q; i++) { cin >> c; cins.push_back(c); } for(int i = 0; i<3*q; i = i+3) { a = cins[i]; b = cins[i+1]; c = cins[i+2]; target = c; seven = 1000000; sodd = 1000000; if (c == 0) { if (a == b) { cout << "YES" << "\n"; } else { cout << "NO" << "\n"; } continue; } search(a,b,1,0); if (c%2 == 0) { if (seven <= c) { cout << "YES" << "\n"; } else { cout << "NO" << "\n"; } } else { if (sodd <= c) { cout << "YES" << "\n"; } else { cout << "NO" << "\n"; } } } }
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
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 NO NO YES ... Truncated |
Test 2
Group: 1, 2
Verdict: ACCEPTED
input |
---|
50 49 100 33 34 7 8 49 50 47 48 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
NO NO NO NO ... 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 ... Truncated |
Test 4
Group: 1, 2
Verdict: ACCEPTED
input |
---|
12 12 100 9 10 2 3 1 12 1 2 ... |
correct output |
---|
NO NO NO NO NO ... |
user output |
---|
NO NO NO NO ... 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 ... 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 ... 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 ... Truncated |
Test 8
Group: 1, 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
50 99 100 40 47 34 50 44 47 15 16 ... |
correct output |
---|
YES YES YES YES YES ... |
user output |
---|
(empty) |
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) |