CSES - KILO 2016 4/5 - Results
Submission details
Task:Highways
Sender:Kaeaepae
Submission time:2016-09-27 18:59:39 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#2ACCEPTED0.05 sdetails
#3ACCEPTED0.06 sdetails
#4ACCEPTED0.06 sdetails
#5ACCEPTED0.07 sdetails
#6ACCEPTED0.05 sdetails
#7ACCEPTED0.05 sdetails
#8ACCEPTED0.05 sdetails
#9ACCEPTED0.05 sdetails
#10ACCEPTED0.05 sdetails
#11ACCEPTED0.28 sdetails
#12ACCEPTED0.20 sdetails
#13ACCEPTED0.40 sdetails
#14ACCEPTED0.27 sdetails
#15ACCEPTED0.40 sdetails
#16ACCEPTED0.06 sdetails
#17ACCEPTED0.05 sdetails
#18ACCEPTED0.05 sdetails
#19ACCEPTED0.06 sdetails
#20ACCEPTED0.04 sdetails
#21--details
#22--details
#23--details
#24--details
#25--details
#26--details
#27ACCEPTED0.69 sdetails
#28ACCEPTED0.22 sdetails
#29--details
#30ACCEPTED0.90 sdetails
#31ACCEPTED0.85 sdetails
#32ACCEPTED0.23 sdetails
#33--details
#34--details
#35--details
#36--details
#37--details
#38--details
#39--details
#40--details
#41--details
#42--details
#43--details
#44--details
#45--details
#46--details
#47--details
#48--details
#49--details
#50--details

Code

#include <iostream>
#include <cassert>
#include <utility>
#include <vector>
#include <array>
#include <set>

using namespace std;

int main() {
  cin.sync_with_stdio(false);

  int n, m;  // <= 1e5
  cin >> n >> m;

  vector< set<int> > rows(n, set<int>());
  vector< set<int> > cols(m, set<int>());
  vector< set<int> > used(m, set<int>());
  vector<bool> parity(n);
  for (int i = 0; i < n; i++) parity[i] = 1;

  // read input
  for (int j = 0; j < m; j++) {
    int a, b;
    cin >> a >> b; a--; b--;
    rows[a].insert(j); cols[j].insert(a);
    rows[b].insert(j); cols[j].insert(b);
  }
  cerr << "input done" << endl;

  // solve linear eqns sum_i(a_i*c_ij) = 1 mod 2 for all j

  for (int j = 0; j < m; j++) {
    cerr << "col " << j << "\n";
    if (cols[j].empty()) continue;
    // pick row i as pivot, xor with all other rows
    int i = *(cols[j].begin());
    cerr << "pivot " << i << "\n";
    bool p = parity[i];

    for (int r : cols[j]) {
      if (r == i) continue;
      cerr << "  row " << r << "\n";
      if (p) parity[r] = !parity[r];
      for (int c : rows[i]) {
	if (rows[r].count(c) != 0) {
	  rows[r].erase(c);
	  if (c != j) cols[c].erase(r);
	  cerr << "    remove " << r << "," << c << "\n";
	}
	else {
	  rows[r].insert(c);
	  if (c != j) cols[c].insert(r);
	  cerr << "    add " << r << "," << c << "\n";
	}
      }
    }
    // ditto for used rows
    for (int r : used[j]) {
      if (r == i) continue;
      cerr << "  used " << r << "\n";
      if (p) parity[r] = !parity[r];
      for (int c : rows[i]) {
	if (rows[r].count(c) != 0) {
	  rows[r].erase(c);
	  if (c != j) used[c].erase(r);
	  cerr << "    un-used " << r << "," << c << "\n";
	}
	else {
	  rows[r].insert(c);
	  if (c != j) used[c].insert(r);
	  cerr << "    used " << r << "," << c << "\n";
	}
      }
    }
    cerr << "  done row " << i << "\n";
    // mark this row as used
    for (int j : rows[i]) {
      cerr << "    using col " << j << "\n";
      cols[j].erase(i);
      used[j].insert(i);
    }
  }

  // do we have a solution?
  for (int i = 0; i < n; i++) {
    if (parity[i] == 1 && rows[i].empty()) {
      cout << "QAQ\n";
      return 0;
    }
  }
  cout << "YAY\n";
}

/*
6 7 1 3 4 1 3 4 4 5 6 4 6 2 2 3
*/

Test details

Test 1

Verdict: ACCEPTED

input
18 22
14 8
15 7
9 14
5 3
...

correct output
YAY

user output
YAY

Error:
input done
col 0
pivot 7
  row 13
    remove 13,0
  done row 7
    using col 0
col 1
pivot 6
  row 14
    remove 14,1
    add 14,6
    add 14,8
    add 14,18
  done row 6
    using col 1
    using col 6
    using col 8
    using col 18
col 2
pivot 8
  row 13
    remove 13,2
    add 13,19
  done row 8
    using col 2
    using col 19
col 3
pivot 2
  row 4
    remove 4,3
    add 4,12
  done row 2
    using col 3
    using col 12
col 4
pivot 3
  row 9
    remove 9,4
    add 9,5
    add 9,16
  done row 3
    using col 4
    using col 5
    using col 16
col 5
pivot 9
  row 11
    remove 11,5
    add 11,15
    add 11,16
  used 3
    un-used 3,5
    used 3,15
    un-used 3,16
  done row 9
    using col 5
    using col 15
    using col 16
col 6
pivot 0
  row 14
    remove 14,6
    add 14,11
    add 14,21
  used 6
    un-used 6,6
    used 6,11
    used 6,21
  done row 0
    using col 6
    using col 11
    using col 21
col 7
pivot 1
  row 5
    remove 5,7
  done row 1
    using col 7
col 8
pivo...

Test 2

Verdict: ACCEPTED

input
13 29
1 12
2 9
4 3
6 3
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 11
    remove 11,0
    add 11,8
    add 11,11
    add 11,13
    add 11,21
  done row 0
    using col 0
    using col 8
    using col 11
    using col 13
    using col 21
col 1
pivot 1
  row 8
    remove 8,1
    add 8,9
    add 8,12
    add 8,22
  done row 1
    using col 1
    using col 9
    using col 12
    using col 22
col 2
pivot 2
  row 3
    remove 3,2
    add 3,3
    add 3,5
    add 3,20
    add 3,23
  done row 2
    using col 2
    using col 3
    using col 5
    using col 20
    using col 23
col 3
pivot 3
  row 5
    remove 5,3
    add 5,5
    add 5,6
    add 5,12
    add 5,13
    add 5,20
    add 5,23
    add 5,24
    add 5,26
    add 5,28
  used 2
    un-used 2,3
    un-used 2,5
    used 2,6
    used 2,12
    used 2,13
    un-used 2,20
    un-used 2,23
    used 2,24
    used 2,26
    used 2,28
  done row 3
    using col 3
    using col 5
    using col 6
    using col 12
    using col 13
    using col 20
    using col 23
    using col 24
    usi...

Test 3

Verdict: ACCEPTED

input
11 28
5 4
2 3
1 4
8 11
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 3
  row 4
    remove 4,0
    add 4,2
    add 4,4
    add 4,10
    add 4,15
    add 4,16
    add 4,18
    add 4,26
  done row 3
    using col 0
    using col 2
    using col 4
    using col 10
    using col 15
    using col 16
    using col 18
    using col 26
col 1
pivot 1
  row 2
    remove 2,1
    add 2,7
    add 2,9
    add 2,14
    add 2,21
    add 2,22
    add 2,26
  done row 1
    using col 1
    using col 7
    using col 9
    using col 14
    using col 21
    using col 22
    using col 26
col 2
pivot 0
  row 4
    remove 4,2
    add 4,8
    add 4,17
    remove 4,23
  used 3
    un-used 3,2
    used 3,8
    used 3,17
    used 3,23
  done row 0
    using col 2
    using col 8
    using col 17
    using col 23
col 3
pivot 7
  row 10
    remove 10,3
    add 10,9
    add 10,15
    add 10,20
    add 10,25
  done row 7
    using col 3
    using col 9
    using col 15
    using col 20
    using col 25
col 4
pivot 4
  row 5
    remove 5,4
    add 5,8
    add 5,10...

Test 4

Verdict: ACCEPTED

input
19 22
1 7
2 6
3 9
4 1
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 6
    remove 6,0
    add 6,3
    add 6,7
    add 6,18
  done row 0
    using col 0
    using col 3
    using col 7
    using col 18
col 1
pivot 1
  row 5
    remove 5,1
    add 5,6
    add 5,13
    add 5,17
    add 5,19
  done row 1
    using col 1
    using col 6
    using col 13
    using col 17
    using col 19
col 2
pivot 2
  row 8
    remove 8,2
    add 8,20
  done row 2
    using col 2
    using col 20
col 3
pivot 3
  row 6
    remove 6,3
    add 6,19
    add 6,21
  used 0
    un-used 0,3
    used 0,19
    used 0,21
  done row 3
    using col 3
    using col 19
    using col 21
col 4
pivot 4
  row 18
    remove 18,4
    add 18,14
  done row 4
    using col 4
    using col 14
col 5
pivot 5
  row 11
    remove 11,5
    add 11,6
    add 11,13
    add 11,17
    add 11,19
  done row 5
    using col 5
    using col 6
    using col 13
    using col 17
    using col 19
col 6
pivot 6
  row 11
    remove 11,6
    add 11,7
    add 11,8
    add 11,18
    remove...

Test 5

Verdict: ACCEPTED

input
18 29
6 1
13 14
16 17
11 4
...

correct output
YAY

user output
YAY

Error:
input done
col 0
pivot 0
  row 5
    remove 5,0
    add 5,4
    add 5,6
    add 5,11
    add 5,20
    add 5,24
    add 5,25
    add 5,26
    add 5,27
  done row 0
    using col 0
    using col 4
    using col 6
    using col 11
    using col 20
    using col 24
    using col 25
    using col 26
    using col 27
col 1
pivot 12
  row 13
    remove 13,1
    add 13,4
  done row 12
    using col 1
    using col 4
col 2
pivot 15
  row 16
    remove 16,2
    add 16,22
    add 16,24
  done row 15
    using col 2
    using col 22
    using col 24
col 3
pivot 3
  row 10
    remove 10,3
    add 10,20
    add 10,28
  done row 3
    using col 3
    using col 20
    using col 28
col 4
pivot 5
  row 13
    remove 13,4
    add 13,6
    add 13,8
    add 13,11
    add 13,18
    add 13,20
    add 13,24
    remove 13,25
    add 13,26
    add 13,27
  used 0
    un-used 0,4
    un-used 0,6
    used 0,8
    un-used 0,11
    used 0,18
    un-used 0,20
    un-used 0,24
    un-used 0,25
    un-used 0,26
    un-...

Test 6

Verdict: ACCEPTED

input
11 25
1 5
2 8
3 1
4 11
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 4
    remove 4,0
    add 4,2
    add 4,10
    add 4,11
    add 4,20
    add 4,21
  done row 0
    using col 0
    using col 2
    using col 10
    using col 11
    using col 20
    using col 21
col 1
pivot 1
  row 7
    remove 7,1
    add 7,12
    add 7,19
    add 7,21
  done row 1
    using col 1
    using col 12
    using col 19
    using col 21
col 2
pivot 2
  row 4
    remove 4,2
    add 4,12
    add 4,13
    add 4,17
    remove 4,24
  used 0
    un-used 0,2
    used 0,12
    used 0,13
    used 0,17
    used 0,24
  done row 2
    using col 2
    using col 12
    using col 13
    using col 17
    using col 24
col 3
pivot 3
  row 10
    remove 10,3
    add 10,4
    add 10,6
    add 10,8
    add 10,11
    add 10,14
    add 10,22
  done row 3
    using col 3
    using col 4
    using col 6
    using col 8
    using col 11
    using col 14
    using col 22
col 4
pivot 4
  row 10
    remove 10,4
    add 10,9
    remove 10,10
    remove 10,11
    add 10,12...

Test 7

Verdict: ACCEPTED

input
15 23
7 4
2 12
3 4
1 3
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 3
  row 6
    remove 6,0
    add 6,2
    add 6,8
  done row 3
    using col 0
    using col 2
    using col 8
col 1
pivot 1
  row 11
    remove 11,1
    add 11,11
    add 11,14
    add 11,18
  done row 1
    using col 1
    using col 11
    using col 14
    using col 18
col 2
pivot 2
  row 6
    remove 6,2
    add 6,3
    add 6,22
  used 3
    un-used 3,2
    used 3,3
    used 3,22
  done row 2
    using col 2
    using col 3
    using col 22
col 3
pivot 0
  row 6
    remove 6,3
    add 6,7
  used 2
    un-used 2,3
    used 2,7
  used 3
    un-used 3,3
    used 3,7
  done row 0
    using col 3
    using col 7
col 4
pivot 9
  row 10
    remove 10,4
    add 10,12
  done row 9
    using col 4
    using col 12
col 5
pivot 5
  row 7
    remove 7,5
    add 7,13
    add 7,19
    add 7,20
    add 7,22
  done row 5
    using col 5
    using col 13
    using col 19
    using col 20
    using col 22
col 6
pivot 8
  row 13
    remove 13,6
    add 13,11
    add 13,12
    add...

Test 8

Verdict: ACCEPTED

input
20 20
1 19
2 20
3 4
4 14
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 18
    remove 18,0
    add 18,5
    add 18,10
    add 18,14
    add 18,17
  done row 0
    using col 0
    using col 5
    using col 10
    using col 14
    using col 17
col 1
pivot 1
  row 19
    remove 19,1
    add 19,18
  done row 1
    using col 1
    using col 18
col 2
pivot 2
  row 3
    remove 3,2
    add 3,9
    add 3,19
  done row 2
    using col 2
    using col 9
    using col 19
col 3
pivot 3
  row 13
    remove 13,3
    add 13,9
    add 13,12
    add 13,15
    add 13,19
  done row 3
    using col 3
    using col 9
    using col 12
    using col 15
    using col 19
col 4
pivot 4
  row 16
    remove 16,4
    add 16,16
  done row 4
    using col 4
    using col 16
col 5
pivot 6
  row 18
    remove 18,5
  used 0
    un-used 0,5
  done row 6
    using col 5
col 6
pivot 7
  row 16
    remove 16,6
  done row 7
    using col 6
col 7
pivot 8
  row 9
    remove 9,7
  done row 8
    using col 7
col 8
pivot 5
  row 10
    remove 10,8
  done row 5
    usin...

Test 9

Verdict: ACCEPTED

input
11 21
9 4
5 1
2 9
1 4
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 3
  row 8
    remove 8,0
    add 8,3
    add 8,13
  done row 3
    using col 0
    using col 3
    using col 13
col 1
pivot 0
  row 4
    remove 4,1
    add 4,3
    add 4,8
    add 4,10
    add 4,11
    add 4,16
    add 4,19
    add 4,20
  done row 0
    using col 1
    using col 3
    using col 8
    using col 10
    using col 11
    using col 16
    using col 19
    using col 20
col 2
pivot 1
  row 8
    remove 8,2
    add 8,5
    add 8,10
  done row 1
    using col 2
    using col 5
    using col 10
col 3
pivot 4
  row 8
    remove 8,3
    add 8,4
    add 8,8
    remove 8,10
    add 8,11
    add 8,16
    remove 8,17
    add 8,19
    add 8,20
  used 0
    un-used 0,3
    used 0,4
    un-used 0,8
    un-used 0,10
    un-used 0,11
    un-used 0,16
    used 0,17
    un-used 0,19
    un-used 0,20
  used 3
    un-used 3,3
    used 3,4
    used 3,8
    used 3,10
    used 3,11
    used 3,16
    used 3,17
    used 3,19
    used 3,20
  done row 4
    using col 3
    usi...

Test 10

Verdict: ACCEPTED

input
17 20
1 17
3 9
4 2
5 7
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 16
    remove 16,0
    add 16,15
  done row 0
    using col 0
    using col 15
col 1
pivot 2
  row 8
    remove 8,1
    add 8,8
    add 8,17
  done row 2
    using col 1
    using col 8
    using col 17
col 2
pivot 1
  row 3
    remove 3,2
    add 3,4
    add 3,10
    add 3,16
  done row 1
    using col 2
    using col 4
    using col 10
    using col 16
col 3
pivot 4
  row 6
    remove 6,3
    add 6,11
  done row 4
    using col 3
    using col 11
col 4
pivot 3
  row 5
    remove 5,4
    add 5,6
    add 5,7
    add 5,10
    add 5,15
    add 5,16
    add 5,18
  used 1
    un-used 1,4
    used 1,6
    used 1,7
    un-used 1,10
    used 1,15
    un-used 1,16
    used 1,18
  done row 3
    using col 4
    using col 6
    using col 7
    using col 10
    using col 15
    using col 16
    using col 18
col 5
pivot 6
  row 10
    remove 10,5
    add 10,11
    add 10,12
  done row 6
    using col 5
    using col 11
    using col 12
col 6
pivot 5
  row 7
    remov...

Test 11

Verdict: ACCEPTED

input
103 4134
58 82
47 91
76 84
96 52
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 57
  row 81
    remove 81,0
    add 81,35
    add 81,130
    add 81,136
    add 81,146
    add 81,223
    add 81,291
    add 81,377
    add 81,406
    add 81,414
    add 81,420
    add 81,458
    add 81,462
    add 81,538
    add 81,718
    add 81,771
    add 81,788
    add 81,854
    add 81,866
    add 81,927
    add 81,930
    add 81,1039
    add 81,1082
    add 81,1124
    add 81,1136
    add 81,1459
    add 81,1467
    add 81,1487
    add 81,1555
    add 81,1700
    add 81,1766
    add 81,1786
    add 81,1788
    add 81,1792
    add 81,1906
    add 81,2046
    add 81,2080
    add 81,2120
    add 81,2163
    add 81,2184
    add 81,2229
    add 81,2290
    add 81,2295
    add 81,2317
    add 81,2406
    add 81,2556
    add 81,2577
    add 81,2629
    add 81,2703
    add 81,2804
    add 81,2822
    add 81,2830
    add 81,2871
    add 81,2906
    add 81,2927
    add 81,2956
    add 81,3028
    add 81,3031
    add 81,3037
    add 81,3077
    add 81,3113
    add 81...

Test 12

Verdict: ACCEPTED

input
135 3338
1 9
2 79
3 59
4 49
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 8
    remove 8,0
    add 8,135
    add 8,207
    add 8,265
    add 8,396
    add 8,467
    add 8,520
    add 8,569
    add 8,645
    add 8,837
    add 8,892
    add 8,893
    add 8,920
    add 8,1010
    add 8,1135
    add 8,1255
    add 8,1354
    add 8,1371
    add 8,1376
    add 8,1489
    add 8,1541
    add 8,1600
    add 8,1621
    add 8,1723
    add 8,1831
    add 8,1934
    add 8,1973
    add 8,2042
    add 8,2088
    add 8,2130
    add 8,2144
    add 8,2240
    add 8,2247
    add 8,2330
    add 8,2343
    add 8,2438
    add 8,2630
    add 8,2729
    add 8,2824
    add 8,2886
    add 8,2998
    add 8,3093
    add 8,3200
    add 8,3211
    add 8,3212
    add 8,3250
    add 8,3252
    add 8,3282
  done row 0
    using col 0
    using col 135
    using col 207
    using col 265
    using col 396
    using col 467
    using col 520
    using col 569
    using col 645
    using col 837
    using col 892
    using col 893
    using col 920
    using col...

Test 13

Verdict: ACCEPTED

input
176 4742
55 158
98 75
33 59
40 127
...

correct output
YAY

user output
YAY

Error:
input done
col 0
pivot 54
  row 157
    remove 157,0
    add 157,25
    add 157,245
    add 157,289
    add 157,345
    add 157,377
    add 157,407
    add 157,859
    add 157,1067
    add 157,1088
    add 157,1408
    add 157,1482
    add 157,1492
    add 157,1836
    add 157,1856
    add 157,1904
    add 157,2077
    add 157,2117
    add 157,2184
    add 157,2251
    add 157,2370
    add 157,2540
    add 157,2689
    add 157,2878
    add 157,2905
    add 157,2919
    add 157,2994
    add 157,3175
    add 157,3230
    add 157,3564
    add 157,3573
    add 157,3595
    add 157,3643
    add 157,3649
    add 157,3711
    add 157,3762
    add 157,3889
    add 157,4154
    add 157,4219
    add 157,4282
    add 157,4389
    add 157,4469
    add 157,4556
    add 157,4573
    add 157,4691
  done row 54
    using col 0
    using col 25
    using col 245
    using col 289
    using col 345
    using col 377
    using col 407
    using col 859
    using col 1067
    using col 1088
    using col...

Test 14

Verdict: ACCEPTED

input
125 3020
1 43
2 44
3 96
4 18
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 42
    remove 42,0
    add 42,94
    add 42,125
    add 42,136
    add 42,247
    add 42,278
    add 42,315
    add 42,395
    add 42,594
    add 42,692
    add 42,711
    add 42,804
    add 42,825
    add 42,934
    add 42,988
    add 42,1041
    add 42,1150
    add 42,1206
    add 42,1213
    add 42,1238
    add 42,1358
    add 42,1559
    add 42,1653
    add 42,1751
    add 42,1842
    add 42,1848
    add 42,1937
    add 42,1947
    add 42,2063
    add 42,2096
    add 42,2107
    add 42,2136
    add 42,2143
    add 42,2171
    add 42,2234
    add 42,2325
    add 42,2357
    add 42,2418
    add 42,2540
    add 42,2582
    add 42,2657
    add 42,2689
    add 42,2738
    add 42,2822
    add 42,2833
    add 42,2883
    add 42,2982
  done row 0
    using col 0
    using col 94
    using col 125
    using col 136
    using col 247
    using col 278
    using col 315
    using col 395
    using col 594
    using col 692
    using col 711
    using col 804...

Test 15

Verdict: ACCEPTED

input
163 4539
40 15
1 136
159 27
41 42
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 14
  row 39
    remove 39,0
    add 39,76
    add 39,138
    add 39,172
    add 39,196
    add 39,234
    add 39,243
    add 39,283
    add 39,333
    add 39,390
    add 39,420
    add 39,470
    add 39,726
    add 39,801
    add 39,899
    add 39,931
    add 39,1000
    add 39,1046
    add 39,1077
    add 39,1135
    add 39,1342
    add 39,1384
    add 39,1692
    add 39,2108
    add 39,2135
    add 39,2162
    add 39,2173
    add 39,2288
    add 39,2315
    add 39,2492
    add 39,2583
    add 39,2609
    add 39,2625
    add 39,2641
    add 39,2714
    add 39,2729
    add 39,2759
    add 39,2892
    add 39,2990
    add 39,3117
    add 39,3238
    add 39,3294
    add 39,3398
    add 39,3417
    add 39,3423
    add 39,3504
    add 39,3535
    add 39,3645
    add 39,3812
    add 39,3824
    add 39,3879
    add 39,3958
    add 39,4018
    add 39,4051
    add 39,4073
    add 39,4110
    add 39,4180
    add 39,4181
    add 39,4222
    add 39,4231
    add 39,4440
    a...

Test 16

Verdict: ACCEPTED

input
1239 188
1 250
2 990
3 241
4 90
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 249
    remove 249,0
  done row 0
    using col 0
col 1
pivot 1
  row 989
    remove 989,1
  done row 1
    using col 1
col 2
pivot 2
  row 240
    remove 240,2
  done row 2
    using col 2
col 3
pivot 3
  row 89
    remove 89,3
  done row 3
    using col 3
col 4
pivot 4
  row 712
    remove 712,4
  done row 4
    using col 4
col 5
pivot 5
  row 354
    remove 354,5
  done row 5
    using col 5
col 6
pivot 6
  row 160
    remove 160,6
  done row 6
    using col 6
col 7
pivot 7
  row 802
    remove 802,7
    add 802,146
  done row 7
    using col 7
    using col 146
col 8
pivot 8
  row 236
    remove 236,8
    add 236,153
  done row 8
    using col 8
    using col 153
col 9
pivot 9
  row 833
    remove 833,9
  done row 9
    using col 9
col 10
pivot 10
  row 1130
    remove 1130,10
  done row 10
    using col 10
col 11
pivot 11
  row 956
    remove 956,11
  done row 11
    using col 11
col 12
pivot 12
  row 1094
    remove 1094,12
  done row 12
    using c...

Test 17

Verdict: ACCEPTED

input
1805 194
99 1473
669 482
1695 156
858 1646
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 98
  row 1472
    remove 1472,0
  done row 98
    using col 0
col 1
pivot 481
  row 668
    remove 668,1
  done row 481
    using col 1
col 2
pivot 155
  row 1694
    remove 1694,2
  done row 155
    using col 2
col 3
pivot 857
  row 1645
    remove 1645,3
  done row 857
    using col 3
col 4
pivot 544
  row 1380
    remove 1380,4
  done row 544
    using col 4
col 5
pivot 336
  row 924
    remove 924,5
  done row 336
    using col 5
col 6
pivot 456
  row 1341
    remove 1341,6
  done row 456
    using col 6
col 7
pivot 884
  row 1501
    remove 1501,7
  done row 884
    using col 7
col 8
pivot 133
  row 1110
    remove 1110,8
  done row 133
    using col 8
col 9
pivot 103
  row 107
    remove 107,9
  done row 103
    using col 9
col 10
pivot 572
  row 1669
    remove 1669,10
  done row 572
    using col 10
col 11
pivot 517
  row 950
    remove 950,11
    add 950,63
  done row 517
    using col 11
    using col 63
col 12
pivot 354
  row 770
    remove 770,12
  do...

Test 18

Verdict: ACCEPTED

input
1043 187
1 288
2 737
3 853
4 72
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 287
    remove 287,0
  done row 0
    using col 0
col 1
pivot 1
  row 736
    remove 736,1
  done row 1
    using col 1
col 2
pivot 2
  row 852
    remove 852,2
  done row 2
    using col 2
col 3
pivot 3
  row 71
    remove 71,3
  done row 3
    using col 3
col 4
pivot 4
  row 787
    remove 787,4
  done row 4
    using col 4
col 5
pivot 5
  row 695
    remove 695,5
  done row 5
    using col 5
col 6
pivot 6
  row 560
    remove 560,6
  done row 6
    using col 6
col 7
pivot 7
  row 411
    remove 411,7
  done row 7
    using col 7
col 8
pivot 8
  row 168
    remove 168,8
  done row 8
    using col 8
col 9
pivot 9
  row 656
    remove 656,9
  done row 9
    using col 9
col 10
pivot 10
  row 615
    remove 615,10
  done row 10
    using col 10
col 11
pivot 11
  row 523
    remove 523,11
  done row 11
    using col 11
col 12
pivot 12
  row 97
    remove 97,12
  done row 12
    using col 12
col 13
pivot 13
  row 458
    remove 458,13
  done row 13
    using...

Test 19

Verdict: ACCEPTED

input
1844 191
602 1650
1622 1101
1389 331
1793 1057
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 601
  row 1649
    remove 1649,0
  done row 601
    using col 0
col 1
pivot 1100
  row 1621
    remove 1621,1
  done row 1100
    using col 1
col 2
pivot 330
  row 1388
    remove 1388,2
  done row 330
    using col 2
col 3
pivot 1056
  row 1792
    remove 1792,3
  done row 1056
    using col 3
col 4
pivot 293
  row 426
    remove 426,4
  done row 293
    using col 4
col 5
pivot 858
  row 1014
    remove 1014,5
  done row 858
    using col 5
col 6
pivot 174
  row 772
    remove 772,6
  done row 174
    using col 6
col 7
pivot 808
  row 1359
    remove 1359,7
  done row 808
    using col 7
col 8
pivot 64
  row 343
    remove 343,8
  done row 64
    using col 8
col 9
pivot 633
  row 929
    remove 929,9
    add 929,44
  done row 633
    using col 9
    using col 44
col 10
pivot 1156
  row 1543
    remove 1543,10
  done row 1156
    using col 10
col 11
pivot 821
  row 1343
    remove 1343,11
  done row 821
    using col 11
col 12
pivot 407
  row 1427
    remove 1427...

Test 20

Verdict: ACCEPTED

input
1320 193
1 348
2 205
3 1074
4 565
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 347
    remove 347,0
  done row 0
    using col 0
col 1
pivot 1
  row 204
    remove 204,1
  done row 1
    using col 1
col 2
pivot 2
  row 1073
    remove 1073,2
  done row 2
    using col 2
col 3
pivot 3
  row 564
    remove 564,3
  done row 3
    using col 3
col 4
pivot 4
  row 113
    remove 113,4
  done row 4
    using col 4
col 5
pivot 5
  row 250
    remove 250,5
  done row 5
    using col 5
col 6
pivot 6
  row 914
    remove 914,6
  done row 6
    using col 6
col 7
pivot 7
  row 338
    remove 338,7
  done row 7
    using col 7
col 8
pivot 8
  row 490
    remove 490,8
  done row 8
    using col 8
col 9
pivot 9
  row 258
    remove 258,9
  done row 9
    using col 9
col 10
pivot 10
  row 324
    remove 324,10
  done row 10
    using col 10
col 11
pivot 11
  row 934
    remove 934,11
  done row 11
    using col 11
col 12
pivot 12
  row 441
    remove 441,12
  done row 12
    using col 12
col 13
pivot 13
  row 1033
    remove 1033,13
  done row 13...

Test 21

Verdict:

input
37937 25088
6333 24947
28242 23895
19867 8587
31583 32446
...

correct output
QAQ

user output
(empty)

Test 22

Verdict:

input
66558 76158
1 59409
2 18517
3 56524
4 11524
...

correct output
QAQ

user output
(empty)

Test 23

Verdict:

input
51952 39128
8910 28624
7521 5624
36437 50565
26552 11722
...

correct output
QAQ

user output
(empty)

Test 24

Verdict:

input
83912 87589
1 83766
2 74513
3 74820
4 57891
...

correct output
QAQ

user output
(empty)

Test 25

Verdict:

input
94126 62566
8925 81992
35359 64973
79825 68011
77418 32726
...

correct output
QAQ

user output
(empty)

Test 26

Verdict:

input
16552 30101
1 8349
2 13806
3 9007
4 2387
...

correct output
YAY

user output
(empty)

Test 27

Verdict: ACCEPTED

input
17594 10589
3512 1331
1098 3073
15746 3865
7413 4396
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 1330
  row 3511
    remove 3511,0
  done row 1330
    using col 0
col 1
pivot 1097
  row 3072
    remove 3072,1
  done row 1097
    using col 1
col 2
pivot 3864
  row 15745
    remove 15745,2
    add 15745,1568
    add 15745,6384
  done row 3864
    using col 2
    using col 1568
    using col 6384
col 3
pivot 4395
  row 7412
    remove 7412,3
    add 7412,10005
  done row 4395
    using col 3
    using col 10005
col 4
pivot 6294
  row 14002
    remove 14002,4
  done row 6294
    using col 4
col 5
pivot 5050
  row 14198
    remove 14198,5
  done row 5050
    using col 5
col 6
pivot 531
  row 16103
    remove 16103,6
    add 16103,5715
    add 16103,9732
  done row 531
    using col 6
    using col 5715
    using col 9732
col 7
pivot 3350
  row 7087
    remove 7087,7
  done row 3350
    using col 7
col 8
pivot 4733
  row 5730
    remove 5730,8
    add 5730,4590
    add 5730,6178
  done row 4733
    using col 8
    using col 4590
    using col 6178
col 9
pivot 3167...

Test 28

Verdict: ACCEPTED

input
83805 16105
1 71350
2 33991
3 35848
4 34777
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 71349
    remove 71349,0
  done row 0
    using col 0
col 1
pivot 1
  row 33990
    remove 33990,1
  done row 1
    using col 1
col 2
pivot 2
  row 35847
    remove 35847,2
  done row 2
    using col 2
col 3
pivot 3
  row 34776
    remove 34776,3
  done row 3
    using col 3
col 4
pivot 4
  row 62814
    remove 62814,4
  done row 4
    using col 4
col 5
pivot 5
  row 60989
    remove 60989,5
  done row 5
    using col 5
col 6
pivot 6
  row 75429
    remove 75429,6
  done row 6
    using col 6
col 7
pivot 7
  row 18047
    remove 18047,7
  done row 7
    using col 7
col 8
pivot 8
  row 39471
    remove 39471,8
  done row 8
    using col 8
col 9
pivot 9
  row 64907
    remove 64907,9
  done row 9
    using col 9
col 10
pivot 10
  row 8250
    remove 8250,10
    add 8250,134
  done row 10
    using col 10
    using col 134
col 11
pivot 11
  row 37539
    remove 37539,11
  done row 11
    using col 11
col 12
pivot 12
  row 58310
    remove 58310,12
  done row...

Test 29

Verdict:

input
18121 59415
4216 9370
15068 8754
15081 16115
12704 4487
...

correct output
QAQ

user output
(empty)

Test 30

Verdict: ACCEPTED

input
83072 54739
1 17640
2 20578
3 7481
4 67768
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 17639
    remove 17639,0
    add 17639,34719
  done row 0
    using col 0
    using col 34719
col 1
pivot 1
  row 20577
    remove 20577,1
    add 20577,2206
    add 20577,48645
  done row 1
    using col 1
    using col 2206
    using col 48645
col 2
pivot 2
  row 7480
    remove 7480,2
  done row 2
    using col 2
col 3
pivot 3
  row 67767
    remove 67767,3
  done row 3
    using col 3
col 4
pivot 4
  row 80185
    remove 80185,4
  done row 4
    using col 4
col 5
pivot 5
  row 20862
    remove 20862,5
    add 20862,6642
  done row 5
    using col 5
    using col 6642
col 6
pivot 6
  row 1730
    remove 1730,6
    add 1730,6178
    add 1730,25401
  done row 6
    using col 6
    using col 6178
    using col 25401
col 7
pivot 7
  row 76777
    remove 76777,7
  done row 7
    using col 7
col 8
pivot 8
  row 66570
    remove 66570,8
  done row 8
    using col 8
col 9
pivot 9
  row 42183
    remove 42183,9
    add 42183,37734
  done row 9
    using col 9...

Test 31

Verdict: ACCEPTED

input
77926 38175
26905 68006
67362 27509
31320 42067
77657 1378
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 26904
  row 68005
    remove 68005,0
    add 68005,15160
  done row 26904
    using col 0
    using col 15160
col 1
pivot 27508
  row 67361
    remove 67361,1
    add 67361,35833
  done row 27508
    using col 1
    using col 35833
col 2
pivot 31319
  row 42066
    remove 42066,2
  done row 31319
    using col 2
col 3
pivot 1377
  row 77656
    remove 77656,3
  done row 1377
    using col 3
col 4
pivot 13162
  row 22464
    remove 22464,4
  done row 13162
    using col 4
col 5
pivot 9932
  row 51256
    remove 51256,5
  done row 9932
    using col 5
col 6
pivot 4344
  row 59851
    remove 59851,6
  done row 4344
    using col 6
col 7
pivot 7791
  row 70250
    remove 70250,7
  done row 7791
    using col 7
col 8
pivot 40189
  row 76506
    remove 76506,8
    add 76506,33052
  done row 40189
    using col 8
    using col 33052
col 9
pivot 48768
  row 70858
    remove 70858,9
    add 70858,17238
  done row 48768
    using col 9
    using col 17238
col 10
pivot 2926...

Test 32

Verdict: ACCEPTED

input
44917 15940
1 41068
2 39644
3 42386
4 7163
...

correct output
QAQ

user output
QAQ

Error:
input done
col 0
pivot 0
  row 41067
    remove 41067,0
    add 41067,928
    add 41067,8234
  done row 0
    using col 0
    using col 928
    using col 8234
col 1
pivot 1
  row 39643
    remove 39643,1
  done row 1
    using col 1
col 2
pivot 2
  row 42385
    remove 42385,2
  done row 2
    using col 2
col 3
pivot 3
  row 7162
    remove 7162,3
    add 7162,12121
  done row 3
    using col 3
    using col 12121
col 4
pivot 4
  row 43998
    remove 43998,4
  done row 4
    using col 4
col 5
pivot 5
  row 43887
    remove 43887,5
  done row 5
    using col 5
col 6
pivot 6
  row 15150
    remove 15150,6
    add 15150,6360
    add 15150,13866
  done row 6
    using col 6
    using col 6360
    using col 13866
col 7
pivot 7
  row 178
    remove 178,7
  done row 7
    using col 7
col 8
pivot 8
  row 15922
    remove 15922,8
    add 15922,9655
  done row 8
    using col 8
    using col 9655
col 9
pivot 9
  row 43192
    remove 43192,9
  done row 9
    using col 9
col 10
pivot 10
  row 9481...

Test 33

Verdict:

input
72700 76527
64456 41883
6850 9796
17524 68963
68586 46776
...

correct output
QAQ

user output
(empty)

Test 34

Verdict:

input
85704 93013
1 59359
2 66400
3 36961
4 67663
...

correct output
QAQ

user output
(empty)

Test 35

Verdict:

input
36756 76953
23747 33048
18369 15323
17010 34156
16318 32438
...

correct output
QAQ

user output
(empty)

Test 36

Verdict:

input
22319 66730
1 12649
2 14406
3 10407
4 1269
...

correct output
QAQ

user output
(empty)

Test 37

Verdict:

input
48048 41788
31994 26627
46295 7660
19069 38273
18860 1487
...

correct output
QAQ

user output
(empty)

Test 38

Verdict:

input
65801 83175
1 26103
2 36748
3 23794
4 102
...

correct output
QAQ

user output
(empty)

Test 39

Verdict:

input
46105 56673
4831 22570
22025 33489
36070 4619
11615 15142
...

correct output
QAQ

user output
(empty)

Test 40

Verdict:

input
93010 96511
1 23739
2 76954
3 83694
4 78590
...

correct output
YAY

user output
(empty)

Test 41

Verdict:

input
50000 100000
15980 46835
23457 49055
30488 40144
10976 47152
...

correct output
QAQ

user output
(empty)

Test 42

Verdict:

input
50000 100000
1 21375
2 45936
3 37365
4 24446
...

correct output
YAY

user output
(empty)

Test 43

Verdict:

input
50000 100000
42443 25098
16932 10533
11575 30560
2686 48416
...

correct output
QAQ

user output
(empty)

Test 44

Verdict:

input
50000 100000
1 2375
2 42853
3 14280
4 47033
...

correct output
YAY

user output
(empty)

Test 45

Verdict:

input
50000 100000
16190 47190
26331 23477
20723 38527
18025 47404
...

correct output
QAQ

user output
(empty)

Test 46

Verdict:

input
100000 100000
1 88825
2 21559
3 54663
4 73730
...

correct output
QAQ

user output
(empty)

Test 47

Verdict:

input
100000 100000
59924 64307
38286 97441
98466 13035
24330 59056
...

correct output
QAQ

user output
(empty)

Test 48

Verdict:

input
100000 100000
1 82358
2 69176
3 36107
4 56588
...

correct output
QAQ

user output
(empty)

Test 49

Verdict:

input
100000 100000
1230 49794
94564 58598
41841 23612
47298 9154
...

correct output
QAQ

user output
(empty)

Test 50

Verdict:

input
100000 100000
1 42055
2 41897
3 65723
4 9205
...

correct output
QAQ

user output
(empty)