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 12:14:34
2018-05-26 12:11:14
Task:Data Packet Routing
Sender:KnowYourArchitecture
Submission time:2018-05-26 12:14:34
Status:READY
Result:ACCEPTED

Show test data

Code

#include <bits/stdc++.h>

using namespace std;

int tt[1010][1010];

void test(int ti) {
	int n, m;
	cin >> n >> m;
	int res = 1;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		if(tt[x][y]==ti)res=2;
		tt[x][y]=ti;
		//pair<int, int> p{x, y};
		/*if (s.count(p)) {
			res = 2;
		}*/
		//s[i] = p;
	}
	cout << res << "\n";
}

int main() {
	int t;
	cin >> t;
	while(t--) test(t+1000);
}