Code Submission Evaluation System Login

CSES - HIIT Open 2018

HIIT Open 2018

Contest start:2018-05-26 11:00:00
Contest end:2018-05-26 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard | Statistics


History
2018-05-26 14:38:34
Task:Data Packet Routing
Sender:Oispa nutellaa
Submission time:2018-05-26 14:38:34
Status:READY
Result:TIME LIMIT EXCEEDED

Show test data

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";
		}
}