CSES - HIIT Open 2018 - Results
Submission details
Task:Data Packet Routing
Sender:Oispa nutellaa
Submission time:2018-05-26 14:38:34 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.84 sdetails
#3--details
#4ACCEPTED0.88 sdetails
#5ACCEPTED0.08 sdetails
#6ACCEPTED0.04 sdetails
#7ACCEPTED0.03 sdetails
#8ACCEPTED0.01 sdetails
#9ACCEPTED0.01 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:21:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(!boo)
    ^~
input/code.cpp:23:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     boo = true;
     ^~~

Code

#include <bits/stdc++.h>
#define ull unsigned long long


using namespace std;

int t, n, m, x, y;
map<pair<int,int>, int> mp;

int main() {
cin >> t;
		for(int g=0; g<t; g++) {
		cin >> n >> m;
		bool boo = false;
		for(int i=0; i<m; i++) {
			cin >> x >> y;
			mp[make_pair(x, y)]++;
		}
		for(auto it = mp.begin(); it!=mp.end(); it++) {
			if(it->second>=2) {
			if(!boo)
				cout << 2 << "\n";
				boo = true;
				break;
			}
		}
		mp.clear();
		if(!boo)
		cout << 1 << "\n";
		}
}

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:

input
10
700 100000
603 318
570 280
374 589
...

correct output
2
2
2
2
2
...

user output
(empty)

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
...