Code Submission Evaluation System Login

HIIT Open 2018

Start:2018-05-26 11:00:00
End:2018-05-26 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2018 - Results
History
2018-05-26 12:49:23
2018-05-26 12:46:57
Task:Data Packet Routing
Sender:Karhukopla
Submission time:2018-05-26 12:49:23
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.01 / 1.00details
#2ACCEPTED0.21 / 1.00details
#3ACCEPTED0.21 / 1.00details
#4ACCEPTED0.21 / 1.00details
#5ACCEPTED0.04 / 1.00details
#6ACCEPTED0.03 / 1.00details
#7ACCEPTED0.02 / 1.00details
#8ACCEPTED0.03 / 1.00details
#9ACCEPTED0.02 / 1.00details

Code

#include <bits/stdc++.h>

#define ll long long
#define lll __int128
#define pii pair<int, int>
#define M 1000000007
#define N 101
#define push_back PB
#define F first
#define S second
using namespace std;

int v[1001][1001];

int solve() {
	int n, m;
	cin>>n>>m;
	int ans = 1;
	vector<pii> q(m);
	for (int i = 0; i < m; i++) {
		int a, b;
		cin>>a>>b;
		if (v[a][b]) {
			ans = 2;
		}
		v[a][b] = 1;
		q[i] = {a, b};
	}
	for (pii p : q) {
		v[p.F][p.S] = 0;
	}
	return ans;
}

int main () {
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll t; cin >> t;
	while(t--) cout<<solve()<<endl;
}

Test details

Test 1

Verdict: ACCEPTED

input
2
10 3
1 2
2 1
3 4
10 3
1 2
1 2
3 4
view   save

correct output
1
2
view   save

user output
1
2
view   save

Test 2

Verdict: ACCEPTED

input
10
400 100000
292 392
33 131
61 254
390 231
242 334
195 108
49 250
15 200
222 312
391 393
2 357
229 137
370 118
303 53
163 16
12 14
333 278
5 196
...
view   save

correct output
2
2
2
2
2
2
2
2
2
2
view   save

user output
2
2
2
2
2
2
2
2
2
2
view   save

Test 3

Verdict: ACCEPTED

input
10
700 100000
603 318
570 280
374 589
676 68
447 538
269 444
170 404
558 427
427 407
692 68
200 150
174 202
547 134
177 27
297 535
578 354
436 552
305 553
...
view   save

correct output
2
2
2
2
2
2
2
2
2
2
view   save

user output
2
2
2
2
2
2
2
2
2
2
view   save

Test 4

Verdict: ACCEPTED

input
10
1000 100000
612 150
630 797
925 44
978 931
80 172
241 34
325 768
395 998
572 424
574 736
769 598
568 455
335 14
733 758
532 837
105 47
464 987
906 587
...
view   save

correct output
2
2
2
2
2
2
2
2
2
2
view   save

user output
2
2
2
2
2
2
2
2
2
2
view   save

Test 5

Verdict: ACCEPTED

input
10
1000 10000
25 713
450 653
659 325
36 201
618 270
153 526
455 663
744 682
247 211
279 254
544 726
357 484
327 711
71 548
816 28
43 10
730 370
709 683
...
view   save

correct output
2
2
2
2
2
2
2
2
2
2
view   save

user output
2
2
2
2
2
2
2
2
2
2
view   save

Test 6

Verdict: ACCEPTED

input
10
1000 3000
804 754
634 483
331 476
776 318
490 483
447 609
387 366
186 739
95 227
758 851
103 936
851 216
439 103
428 320
455 702
972 76
495 653
112 798
...
view   save

correct output
2
2
2
2
2
2
2
2
2
2
view   save

user output
2
2
2
2
2
2
2
2
2
2
view   save

Test 7

Verdict: ACCEPTED

input
10
1000 1000
529 538
501 784
783 645
797 802
497 500
705 715
93 98
619 255
411 325
157 491
42 51
609 614
203 206
621 626
278 615
623 625
30 35
328 329
...
view   save

correct output
2
2
2
2
2
1
2
1
1
1
view   save

user output
2
2
2
2
2
1
2
1
1
1
view   save

Test 8

Verdict: ACCEPTED

input
10
1000 300
602 710
622 952
254 471
996 124
816 793
673 679
672 674
340 862
716 64
599 600
731 165
549 557
131 133
491 495
960 963
945 736
169 176
54 64
...
view   save

correct output
1
2
2
1
1
1
1
2
1
2
view   save

user output
1
2
2
1
1
1
1
2
1
2
view   save

Test 9

Verdict: ACCEPTED

input
10
1000 100
295 836
509 67
436 838
141 640
115 158
376 328
35 939
924 902
659 456
289 538
361 608
169 636
317 196
246 208
642 885
617 368
887 261
318 871
...
view   save

correct output
1
1
1
1
1
1
1
2
1
1
view   save

user output
1
1
1
1
1
1
1
2
1
1
view   save