Task: | Data Packet Routing |
Sender: | Ukkonen Fan Club |
Submission time: | 2018-05-26 11:41:23 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.22 s | details |
#3 | ACCEPTED | 0.30 s | details |
#4 | ACCEPTED | 0.22 s | details |
#5 | ACCEPTED | 0.05 s | details |
#6 | ACCEPTED | 0.03 s | details |
#7 | ACCEPTED | 0.01 s | details |
#8 | ACCEPTED | 0.01 s | details |
#9 | ACCEPTED | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:25:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < adds.size(); ++i) { ~~^~~~~~~~~~~~~
Code
#include <iostream> #include <vector> const int N = 1000; bool used[N][N]; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); int t; std::cin >> t; for (int cs = 0; cs < t; ++cs) { int n, m; std::cin >> n >> m; int ans = 1; std::vector<std::pair<int, int>> adds; for (int i = 0; i < m; ++i) { int a, b; std::cin >> a >> b; if (used[a][b]) ans = 2; used[a][b] = true; adds.push_back({a, b}); } std::cout << ans << '\n'; for (int i = 0; i < adds.size(); ++i) { used[adds[i].first][adds[i].second] = false; } } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 10 3 1 2 2 1 3 4 ... |
correct output |
---|
1 2 |
user output |
---|
1 2 |
Test 2
Verdict: ACCEPTED
input |
---|
10 400 100000 292 392 33 131 61 254 ... |
correct output |
---|
2 2 2 2 2 ... |
user output |
---|
2 2 2 2 2 ... |
Test 3
Verdict: ACCEPTED
input |
---|
10 700 100000 603 318 570 280 374 589 ... |
correct output |
---|
2 2 2 2 2 ... |
user output |
---|
2 2 2 2 2 ... |
Test 4
Verdict: ACCEPTED
input |
---|
10 1000 100000 612 150 630 797 925 44 ... |
correct output |
---|
2 2 2 2 2 ... |
user output |
---|
2 2 2 2 2 ... |
Test 5
Verdict: ACCEPTED
input |
---|
10 1000 10000 25 713 450 653 659 325 ... |
correct output |
---|
2 2 2 2 2 ... |
user output |
---|
2 2 2 2 2 ... |
Test 6
Verdict: ACCEPTED
input |
---|
10 1000 3000 804 754 634 483 331 476 ... |
correct output |
---|
2 2 2 2 2 ... |
user output |
---|
2 2 2 2 2 ... |
Test 7
Verdict: ACCEPTED
input |
---|
10 1000 1000 529 538 501 784 783 645 ... |
correct output |
---|
2 2 2 2 2 ... |
user output |
---|
2 2 2 2 2 ... |
Test 8
Verdict: ACCEPTED
input |
---|
10 1000 300 602 710 622 952 254 471 ... |
correct output |
---|
1 2 2 1 1 ... |
user output |
---|
1 2 2 1 1 ... |
Test 9
Verdict: ACCEPTED
input |
---|
10 1000 100 295 836 509 67 436 838 ... |
correct output |
---|
1 1 1 1 1 ... |
user output |
---|
1 1 1 1 1 ... |