QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#505325#7278. Brought Down the Grading Server?PCTprobability50 415ms118756kbC++145.9kb2024-08-05 02:23:482024-08-05 02:23:49

Judging History

你现在查看的是最新测评结果

  • [2024-08-05 02:23:49]
  • 评测
  • 测评结果:50
  • 用时:415ms
  • 内存:118756kb
  • [2024-08-05 02:23:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define endl "\n"
typedef pair<int, int> Pii;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i))
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(x) begin(x), end(x)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(s) (s).begin(),(s).end()
#define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i)
#define drep(i, n) drep2(i, n, 0)
#define rever(vec) reverse(vec.begin(), vec.end())
#define sor(vec) sort(vec.begin(), vec.end())
#define fi first
#define FOR_(n) for (ll _ = 0; (_) < (ll)(n); ++(_))
#define FOR(i, n) for (ll i = 0; (i) < (ll)(n); ++(i))
#define se second
#define pb push_back
#define P pair<ll,ll>
#define PQminll priority_queue<ll, vector<ll>, greater<ll>>
#define PQmaxll priority_queue<ll,vector<ll>,less<ll>>
#define PQminP priority_queue<P, vector<P>, greater<P>>
#define PQmaxP priority_queue<P,vector<P>,less<P>>
#define NP next_permutation
#define die(a) {cout<<a<<endl;return 0;}
#define dier(a) {return a;}
//const ll mod = 1000000009;
const ll mod = 998244353;
//const ll mod = 1000000007;
const ll inf = 4000000000000000000ll;
const ld eps = ld(0.00000000001);
static const long double pi = 3.141592653589793;
template<class T>void vcin(vector<T> &n){for(int i=0;i<int(n.size());i++) cin>>n[i];}
template<class T,class K>void vcin(vector<T> &n,vector<K> &m){for(int i=0;i<int(n.size());i++) cin>>n[i]>>m[i];}
template<class T>void vcout(vector<T> &n){for(int i=0;i<int(n.size());i++){cout<<n[i]<<" ";}cout<<endl;}
template<class T>void vcin(vector<vector<T>> &n){for(int i=0;i<int(n.size());i++){for(int j=0;j<int(n[i].size());j++){cin>>n[i][j];}}}
template<class T>void vcout(vector<vector<T>> &n){for(int i=0;i<int(n.size());i++){for(int j=0;j<int(n[i].size());j++){cout<<n[i][j]<<" ";}cout<<endl;}cout<<endl;}
void yes(bool a){cout<<(a?"yes":"no")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}
void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void possible(bool a){ cout<<(a?"possible":"impossible")<<endl; }
void Possible(bool a){ cout<<(a?"Possible":"Impossible")<<endl; }
void POSSIBLE(bool a){ cout<<(a?"POSSIBLE":"IMPOSSIBLE")<<endl; }
#define FOR_R(i, n) for (ll i = (ll)(n)-1; (i) >= 0; --(i))
template<class T>auto min(const T& a){ return *min_element(all(a)); }
//template<class T>auto max(const T& a){ return *max_element(all(a)); }
template<class T,class F>void print(pair<T,F> a){cout<<a.fi<<" "<<a.se<<endl;}
template<class T>bool chmax(T &a,const T b) { if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a,const T b) { if (b<a) { a=b; return 1; } return 0;}
template<class T> void ifmin(T t,T u){if(t>u){cout<<-1<<endl;}else{cout<<t<<endl;}}
template<class T> void ifmax(T t,T u){if(t>u){cout<<-1<<endl;}else{cout<<t<<endl;}}
ll fastgcd(ll u,ll v){ll shl=0;while(u&&v&&u!=v){bool eu=!(u&1);bool ev=!(v&1);if(eu&&ev){++shl;u>>=1;v>>=1;}else if(eu&&!ev){u>>=1;}else if(!eu&&ev){v>>=1;}else if(u>=v){u=(u-v)>>1;}else{ll tmp=u;u=(v-u)>>1;v=tmp;}}return !u?v<<shl:u<<shl;}
ll modPow(ll a, ll n, ll mod) { if(mod==1) return 0;ll ret = 1; ll p = a % mod; while (n) { if (n & 1) ret = ret * p % mod; p = p * p % mod; n >>= 1; } return ret; }
vector<ll> divisor(ll x){ vector<ll> ans; for(ll i = 1; i * i <= x; i++){ if(x % i == 0) {ans.push_back(i); if(i*i!=x){ ans.push_back(x / ans[i]);}}}sor(ans); return ans; }
ll pop(ll x){return __builtin_popcountll(x);}
ll poplong(ll x){ll y=-1;while(x){x/=2;y++;}return y;}
P hyou(P a){ll x=fastgcd(abs(a.fi),abs(a.se));a.fi/=x;a.se/=x;if(a.se<0){a.fi*=-1;a.se*=-1;}return a;}
P Pplus(P a,P b){ return hyou({a.fi*b.se+b.fi*a.se,a.se*b.se});}
P Ptimes(P a,ll b){ return hyou({a.fi*b,a.se});}
P Ptimes(P a,P b){ return hyou({a.fi*b.fi,a.se*b.se});}
P Pminus(P a,P b){ return hyou({a.fi*b.se-b.fi*a.se,a.se*b.se});}
P Pgyaku(P a){ return hyou({a.se,a.fi});}
 
void cincout(){
  ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
  cout<< fixed << setprecision(15);
}
vector<vector<ll>> solve(ll n,ll s,ll t,vector<vector<ll>> a){
  if(s==1) return a;
  vector<ll> used(n*s);
  vector<vector<P>> g(t);
  for(int i=0;i<n;i++){
    for(int j=0;j+1<s;j+=2){
      g[a[i][j]].pb({a[i][j+1],s*i+j});
      g[a[i][j+1]].pb({a[i][j],s*i+j});
    }
  }
 /* for(auto e:g){
    for(auto f:e) cerr<<f.fi<<" ";
    cerr<<endl;
  } */
  vector<ll> id(t);
  vector<ll> f(t);
  for(int i=0;i<t;i++) f[i]=g[i].size();
  vector<vector<ll>> p(n),q(n);
  auto dfs = [&](int v,auto& self) -> void {
   // cerr<<v<<endl;
   // for(auto e:id) cerr<<e<<" ";
   // cerr<<endl;
    while(id[v]<g[v].size()){
      if(used[g[v][id[v]].se]){
        id[v]++;
        continue;
      }
      ll u=g[v][id[v]].se,u2=g[v][id[v]].fi;
      f[v]--;
      f[g[v][id[v]].fi]--;
      p[u/s].pb(v);
      q[u/s].pb(g[v][id[v]].fi);
      used[g[v][id[v]].se]=1;
      id[v]++;
      self(u2,self);
    }
  };
  for(int i=0;i<t;i++){
    if(f[i]%2) dfs(i,dfs);
  }
  for(int i=0;i<t;i++){
    if(f[i]) dfs(i,dfs);
  }
  /*
  cerr<<"p"<<endl;
  for(auto e:p){
    for(auto f:e) cerr<<f<<" ";
    cerr<<endl;
  }
  cerr<<"q"<<endl;
  for(auto e:q){
    for(auto f:e) cerr<<f<<" ";
    cerr<<endl;
  }
  */
  auto x=solve(n,s/2,t,p),y=solve(n,s/2,t,q);
  vector<vector<ll>> r(n);
  for(int i=0;i<n;i++){
    for(auto e:x[i]) r[i].pb(e);
    for(auto e:y[i]) r[i].pb(e);
  }
  return r;
}
int main(){
  cincout();
  ll n,s,t;
  cin>>n>>s>>t;
  vector<vector<ll>> a(n);
  for(int i=0;i<n;i++){
    a[i].resize(s);
    for(int j=0;j<s;j++){
      cin>>a[i][j];
      a[i][j]--;
    }
  }
  vector<vector<ll>> r=solve(n,s,t,a);
  for(auto e:r){
    for(auto f:e) cout<<f+1<<" ";
    cout<<endl;
  }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 0ms
memory: 3624kb

input:

3 2 3
1 2
2 3
2 3

output:

1 2 
2 3 
3 2 

result:

ok 

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3628kb

input:

20 2 20
18 2
12 5
20 9
4 2
17 4
7 15
9 2
5 5
13 15
19 5
3 5
10 19
8 5
7 10
9 11
3 16
7 18
9 5
3 8
18 4

output:

2 18 
5 12 
9 20 
2 4 
4 17 
7 15 
9 2 
5 5 
15 13 
19 5 
5 3 
10 19 
8 5 
7 10 
9 11 
3 16 
18 7 
5 9 
3 8 
4 18 

result:

wrong answer 

Subtask #2:

score: 15
Accepted

Test #8:

score: 15
Accepted
time: 75ms
memory: 60708kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

14894 70318 
90327 32116 
63866 29061 
53683 63612 
70370 78264 
76881 42647 
39251 31741 
66491 61186 
57686 65819 
59145 53278 
26052 71962 
81040 55279 
50859 51310 
46800 24546 
91165 85013 
61530 21890 
29099 84003 
33573 86182 
10639 49212 
97312 91851 
57682 14067 
5243 69674 
99007 62508 
55...

result:

ok 

Test #9:

score: 15
Accepted
time: 45ms
memory: 60796kb

input:

100000 2 100000
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
5...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #10:

score: 15
Accepted
time: 48ms
memory: 60796kb

input:

99555 2 99555
2 1
3 2
3 4
4 5
6 5
7 6
7 8
8 9
10 9
11 10
11 12
12 13
14 13
15 14
15 16
16 17
18 17
19 18
19 20
20 21
22 21
23 22
23 24
24 25
26 25
27 26
27 28
28 29
30 29
31 30
31 32
32 33
34 33
35 34
35 36
36 37
38 37
39 38
39 40
40 41
42 41
43 42
43 44
44 45
46 45
47 46
47 48
48 49
50 49
51 50
51 ...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #11:

score: 15
Accepted
time: 63ms
memory: 59532kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

59126 27085 
75021 23663 
78883 67175 
3919 90698 
20718 67504 
44011 49374 
3236 1660 
79270 71971 
90540 24502 
9732 54202 
14395 88659 
56600 52635 
17986 21912 
92420 56526 
3472 40254 
20431 64330 
56003 9381 
45529 57750 
9388 45230 
83797 53437 
47526 75562 
63126 45219 
71020 87437 
2016 502...

result:

ok 

Test #12:

score: 15
Accepted
time: 73ms
memory: 52148kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

13223 16598 
19981 18759 
2642 8681 
4102 18080 
16749 11473 
690 15290 
16229 17900 
10684 17481 
12171 6328 
1150 9417 
7185 5689 
10346 17102 
9727 17958 
2117 13756 
10955 13157 
245 2840 
5337 5257 
6429 16622 
10772 17516 
19349 13007 
11359 2821 
8897 14341 
3974 2482 
17966 16241 
15458 1814...

result:

ok 

Test #13:

score: 15
Accepted
time: 45ms
memory: 55040kb

input:

99006 2 11
7 2
3 10
10 8
1 8
5 2
3 6
6 3
5 3
6 8
7 7
4 7
1 3
7 6
10 5
6 4
9 9
8 4
2 9
6 1
10 7
10 1
9 7
6 9
6 9
3 10
10 10
6 2
7 7
6 5
3 8
4 4
5 2
5 8
8 2
10 9
8 3
7 4
2 2
8 9
8 10
8 9
2 1
1 5
4 7
4 9
6 9
8 10
2 4
6 3
4 1
2 10
3 5
10 7
7 1
4 10
6 6
1 4
4 8
10 9
3 9
5 5
6 1
9 2
2 7
9 5
9 8
1 3
5 6
7 ...

output:

2 7 
10 3 
8 10 
1 8 
5 2 
3 6 
6 3 
3 5 
6 8 
7 7 
7 4 
1 3 
7 6 
10 5 
4 6 
9 9 
8 4 
9 2 
6 1 
7 10 
10 1 
9 7 
6 9 
6 9 
3 10 
10 10 
2 6 
7 7 
5 6 
8 3 
4 4 
2 5 
5 8 
8 2 
10 9 
3 8 
4 7 
2 2 
9 8 
8 10 
8 9 
1 2 
1 5 
4 7 
9 4 
6 9 
10 8 
2 4 
3 6 
4 1 
10 2 
5 3 
7 10 
1 7 
10 4 
6 6 
4 1 
8...

result:

ok 

Test #14:

score: 15
Accepted
time: 67ms
memory: 60240kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

53479 25002 
53479 63606 
53479 40735 
53479 83340 
53479 40775 
53479 11458 
53479 8684 
53479 60405 
53479 45116 
53479 67722 
53479 26014 
53479 87860 
53479 55147 
53479 22726 
53479 67769 
53479 129 
53479 14600 
53479 21514 
53479 32164 
53479 60088 
53479 25415 
53479 70946 
53479 27091 
5347...

result:

ok 

Test #15:

score: 15
Accepted
time: 80ms
memory: 60724kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
63660 79073 
41795 20397 
84311 1296 
3690 21178 
21052 31611 
51423 14323 
34208 82468 
2785 83835 
50594 28274 
10993 59957 
34259 64334 
73934 89407 
61083 14947 
53201 89472 
33351 61243 
76632 58718 
67464 85318 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
85776 ...

result:

ok 

Test #16:

score: 15
Accepted
time: 81ms
memory: 51608kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

83824 80944 
25208 26621 
57146 28836 
18169 43915 
47842 59242 
34224 78881 
20722 38791 
89723 91046 
40306 72800 
92681 94906 
41151 7263 
76035 13332 
93928 38800 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
42596 44111 
36037 77687 
836 64592 
35187 43568 
34861 88539 
37477 22111 
85787...

result:

ok 

Test #17:

score: 15
Accepted
time: 50ms
memory: 60852kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

91980 92592 
10704 12359 
56718 35873 
20301 28601 
78422 55548 
59974 74736 
81664 29025 
55916 70432 
34185 47381 
31764 56168 
30947 33997 
9029 70076 
52532 67057 
79680 99273 
54410 56704 
71652 45238 
12615 6894 
78041 66478 
40520 5451 
58133 5950 
89237 70551 
36028 97551 
83553 90630 
15211...

result:

ok 

Test #18:

score: 15
Accepted
time: 71ms
memory: 61260kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

40457 79301 
80634 40457 
21580 49074 
14354 92701 
70461 44540 
47637 47132 
27979 84954 
60683 87556 
22633 43063 
49914 63643 
3571 4494 
88758 53632 
50019 17055 
79039 49334 
50111 67659 
48061 17945 
84596 60323 
14629 72033 
30069 77184 
36217 64209 
35279 49947 
45866 44707 
58146 58484 
533...

result:

ok 

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #19:

score: 5
Accepted
time: 80ms
memory: 60532kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

14894 70318 
90327 32116 
63866 29061 
53683 63612 
70370 78264 
76881 42647 
39251 31741 
66491 61186 
57686 65819 
59145 53278 
26052 71962 
81040 55279 
50859 51310 
46800 24546 
91165 85013 
61530 21890 
29099 84003 
33573 86182 
10639 49212 
97312 91851 
57682 14067 
5243 69674 
99007 62508 
55...

result:

ok 

Test #20:

score: 5
Accepted
time: 41ms
memory: 60888kb

input:

100000 2 100000
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
5...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #21:

score: 5
Accepted
time: 45ms
memory: 60792kb

input:

99555 2 99555
2 1
3 2
3 4
4 5
6 5
7 6
7 8
8 9
10 9
11 10
11 12
12 13
14 13
15 14
15 16
16 17
18 17
19 18
19 20
20 21
22 21
23 22
23 24
24 25
26 25
27 26
27 28
28 29
30 29
31 30
31 32
32 33
34 33
35 34
35 36
36 37
38 37
39 38
39 40
40 41
42 41
43 42
43 44
44 45
46 45
47 46
47 48
48 49
50 49
51 50
51 ...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #22:

score: 0
Wrong Answer
time: 75ms
memory: 55456kb

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

47641 2360 
32311 27712 
5576 96580 
69601 74432 
5497 90724 
72215 61408 
23207 86499 
29593 43465 
49534 20236 
95890 83680 
35990 98338 
14744 39222 
72902 65183 
76527 73553 
27695 40936 
96356 68239 
66861 20211 
9499 59817 
53200 65669 
74170 53434 
44590 79062 
45816 66321 
37251 32926 
26433...

result:

wrong answer 

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 15
Accepted

Test #56:

score: 15
Accepted
time: 0ms
memory: 3540kb

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

2 2 2 3 
2 3 3 2 
3 2 2 2 

result:

ok 

Test #57:

score: 15
Accepted
time: 0ms
memory: 6344kb

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 475 1156 540 
750 2421 1328 2439 
471 2007 1051 1792 
1776 2269 705 786 
1622 1277 1674 755 
603 1378 590 1217 
1920 967 239 1658 
857 1589 78 2307 
861 2322 1634 2172 
1381 2077 2021 2179 
345 2126 1547 1126 
994 412 1477 1214 
1857 831 978 2085 
281 2174 2406 1844 
1779 521 2254 2334 
1903 90...

result:

ok 

Test #58:

score: 15
Accepted
time: 2ms
memory: 5752kb

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 2 3 2 
1429 1 1 1429 
3 4 7 4 
1430 3 1430 3 
5 6 6 1 
1431 5 1431 5 
7 8 11 8 
1432 7 1432 7 
9 10 5 10 
1433 9 9 1433 
11 12 15 12 
1434 11 1434 11 
13 14 14 9 
1435 13 1435 13 
15 16 19 16 
1436 15 1436 15 
17 18 13 18 
1437 17 17 1437 
19 20 23 20 
1438 19 1438 19 
21 22 22 17 
1439 21 1439 21...

result:

ok 

Test #59:

score: 15
Accepted
time: 4ms
memory: 6616kb

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

2773 3581 
462 1582 
1171 208 
4865 74 
10 1018 
2532 1962 
1491 578 
1140 4567 
4785 3640 
3325 1051 
2135 4545 
1152 286 
309 4874 
3646 1953 
234 1794 
3529 1223 
3751 1002 
4740 3427 
4638 2554 
933 1988 
3177 1846 
2671 2440 
1315 3502 
1382 2669 
443 3145 
438 2418 
420 1154 
3875 671 
3152 18...

result:

ok 

Test #60:

score: 15
Accepted
time: 4ms
memory: 6372kb

input:

4900 2 4900
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 51...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #61:

score: 15
Accepted
time: 0ms
memory: 6412kb

input:

4900 2 4900
2 1
3 2
3 4
4 5
6 5
7 6
7 8
8 9
10 9
11 10
11 12
12 13
14 13
15 14
15 16
16 17
18 17
19 18
19 20
20 21
22 21
23 22
23 24
24 25
26 25
27 26
27 28
28 29
30 29
31 30
31 32
32 33
34 33
35 34
35 36
36 37
38 37
39 38
39 40
40 41
42 41
43 42
43 44
44 45
46 45
47 46
47 48
48 49
50 49
51 50
51 52...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #62:

score: 15
Accepted
time: 7ms
memory: 5264kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

60 89 29 62 109 89 3 83 125 97 92 119 123 140 13 33 145 104 62 125 57 4 19 5 123 122 155 102 36 154 14 132 60 80 123 145 151 86 125 29 76 122 95 55 36 26 19 9 89 109 102 116 19 128 12 114 155 101 72 66 36 7 97 93 
2 122 27 3 123 10 125 122 4 55 109 47 104 93 29 63 156 60 109 27 123 28 90 119 125 71 ...

result:

ok 

Test #63:

score: 15
Accepted
time: 7ms
memory: 4968kb

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

1 1 1 8 1 8 6 4 1 1 6 4 1 8 6 5 1 8 1 6 1 8 6 4 1 6 8 5 1 6 4 8 1 8 1 8 1 6 1 4 1 1 6 8 6 5 8 4 1 6 1 6 1 8 5 4 1 1 8 6 8 6 4 5 1 1 1 8 1 4 6 8 1 1 8 6 4 6 8 5 1 1 1 6 6 4 8 5 1 6 4 8 1 6 8 5 1 6 1 8 1 6 8 4 1 1 8 6 5 8 6 4 1 1 8 6 1 4 8 5 1 6 8 4 1 6 8 5 1 1 6 8 1 4 8 6 1 1 8 6 1 8 5 4 1 1 6 8 1 4 ...

result:

ok 

Test #64:

score: 15
Accepted
time: 5ms
memory: 6396kb

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

1986 967 595 1326 
880 19 173 2187 
843 961 1179 1645 
177 1566 1102 1225 
354 1065 1553 961 
1276 1814 611 625 
845 1110 572 1097 
780 1291 2178 2041 
415 1138 2390 1531 
1131 584 499 1649 
752 754 1296 1982 
498 1853 1627 2295 
974 1647 1282 1628 
2097 265 1271 2321 
2252 1161 123 1776 
424 439 48...

result:

ok 

Test #65:

score: 15
Accepted
time: 3ms
memory: 6160kb

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

1 2 
2 2 
2 1 
2 2 
1 2 
1 1 
2 1 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
1 2 
1 1 
2 1 
1 2 
1 1 
2 1 
1 1 
2 2 
1 2 
2 1 
2 2 
1 1 
2 2 
1 1 
1 2 
2 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 1 
2 2 
1 2 
2 2 
1 1 
2 1 
1 2 
2 1 
1 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
2 2 
2 1 
...

result:

ok 

Test #66:

score: 15
Accepted
time: 0ms
memory: 6372kb

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2674 2970 
2674 1208 
2674 4977 
2674 3028 
2674 36 
2674 1712 
2674 3561 
2674 3033 
2674 4699 
2674 1785 
2674 4345 
2674 3302 
2674 2493 
2674 4280 
2674 3999 
2674 4850 
2674 4508 
2674 3742 
2674 2718 
2674 3461 
2674 260 
2674 4223 
2674 2069 
2674 1144 
2674 1975 
2674 527 
2674 3260 
2674 28...

result:

ok 

Test #67:

score: 15
Accepted
time: 4ms
memory: 6096kb

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

417 793 317 657 
1237 507 1460 1990 
1744 1114 1030 1155 
868 2376 1284 486 
665 704 1441 2391 
789 173 1607 1283 
2192 1045 1309 1466 
766 254 284 734 
1181 1752 1814 937 
1638 2346 1329 1459 
443 1155 1744 1205 
430 1098 1050 1096 
930 186 2224 1622 
1916 1833 1772 2196 
114 2066 739 757 
277 786 ...

result:

ok 

Test #68:

score: 15
Accepted
time: 3ms
memory: 5872kb

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

861 580 926 67 795 830 788 833 
227 582 823 421 566 768 701 113 
188 494 910 644 981 76 868 745 
210 665 742 751 771 875 572 409 
131 387 3 455 298 442 145 151 
250 74 85 78 118 694 550 672 
944 977 431 807 695 533 855 857 
615 523 789 787 432 881 742 649 
42 619 942 159 29 538 114 894 
28 480 602 6...

result:

ok 

Test #69:

score: 15
Accepted
time: 5ms
memory: 5476kb

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

981 969 161 1246 131 598 374 761 
749 826 658 119 837 257 674 163 
863 891 929 207 802 1166 733 564 
77 233 314 507 311 964 400 202 
71 709 388 1093 376 445 408 1247 
966 581 566 403 1020 19 468 48 
703 1201 946 479 785 132 822 730 
37 861 183 188 1202 731 18 349 
126 896 648 614 882 523 1226 333 
1...

result:

ok 

Subtask #6:

score: 0
Wrong Answer

Dependency #5:

100%
Accepted

Test #70:

score: 5
Accepted
time: 0ms
memory: 3596kb

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

2 2 2 3 
2 3 3 2 
3 2 2 2 

result:

ok 

Test #71:

score: 5
Accepted
time: 5ms
memory: 6108kb

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 475 1156 540 
750 2421 1328 2439 
471 2007 1051 1792 
1776 2269 705 786 
1622 1277 1674 755 
603 1378 590 1217 
1920 967 239 1658 
857 1589 78 2307 
861 2322 1634 2172 
1381 2077 2021 2179 
345 2126 1547 1126 
994 412 1477 1214 
1857 831 978 2085 
281 2174 2406 1844 
1779 521 2254 2334 
1903 90...

result:

ok 

Test #72:

score: 5
Accepted
time: 4ms
memory: 5844kb

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 2 3 2 
1429 1 1 1429 
3 4 7 4 
1430 3 1430 3 
5 6 6 1 
1431 5 1431 5 
7 8 11 8 
1432 7 1432 7 
9 10 5 10 
1433 9 9 1433 
11 12 15 12 
1434 11 1434 11 
13 14 14 9 
1435 13 1435 13 
15 16 19 16 
1436 15 1436 15 
17 18 13 18 
1437 17 17 1437 
19 20 23 20 
1438 19 1438 19 
21 22 22 17 
1439 21 1439 21...

result:

ok 

Test #73:

score: 5
Accepted
time: 2ms
memory: 6352kb

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

2773 3581 
462 1582 
1171 208 
4865 74 
10 1018 
2532 1962 
1491 578 
1140 4567 
4785 3640 
3325 1051 
2135 4545 
1152 286 
309 4874 
3646 1953 
234 1794 
3529 1223 
3751 1002 
4740 3427 
4638 2554 
933 1988 
3177 1846 
2671 2440 
1315 3502 
1382 2669 
443 3145 
438 2418 
420 1154 
3875 671 
3152 18...

result:

ok 

Test #74:

score: 5
Accepted
time: 3ms
memory: 6628kb

input:

4900 2 4900
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 51...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #75:

score: 5
Accepted
time: 3ms
memory: 6656kb

input:

4900 2 4900
2 1
3 2
3 4
4 5
6 5
7 6
7 8
8 9
10 9
11 10
11 12
12 13
14 13
15 14
15 16
16 17
18 17
19 18
19 20
20 21
22 21
23 22
23 24
24 25
26 25
27 26
27 28
28 29
30 29
31 30
31 32
32 33
34 33
35 34
35 36
36 37
38 37
39 38
39 40
40 41
42 41
43 42
43 44
44 45
46 45
47 46
47 48
48 49
50 49
51 50
51 52...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #76:

score: 0
Wrong Answer
time: 6ms
memory: 5284kb

input:

156 64 50
36 22 8 7 45 26 10 16 37 31 13 17 1 6 48 13 36 23 46 30 47 28 11 34 21 43 3 3 22 40 38 2 38 25 2 1 42 36 10 41 36 17 26 37 41 49 8 24 20 5 20 18 6 6 21 13 3 45 28 32 32 15 38 10
30 6 47 18 29 14 27 4 4 4 4 24 13 28 38 32 36 25 16 42 35 41 15 47 39 46 50 46 3 17 12 24 46 45 28 22 43 26 45 1...

output:

32 28 3 45 10 36 13 37 8 22 2 46 20 41 6 17 6 36 1 41 26 13 17 37 7 21 42 18 10 32 11 38 36 10 3 38 24 26 13 49 20 15 6 2 28 23 36 40 48 8 45 38 3 30 22 43 1 25 5 31 47 16 34 21 
49 26 6 30 14 3 46 4 35 13 27 38 30 28 47 24 24 46 23 34 24 31 20 44 20 45 25 28 16 15 43 4 18 47 46 45 10 50 6 32 45 22 ...

result:

wrong answer 

Subtask #7:

score: 0
Skipped

Dependency #6:

0%

Subtask #8:

score: 20
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Test #117:

score: 20
Accepted
time: 75ms
memory: 60500kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

14894 70318 
90327 32116 
63866 29061 
53683 63612 
70370 78264 
76881 42647 
39251 31741 
66491 61186 
57686 65819 
59145 53278 
26052 71962 
81040 55279 
50859 51310 
46800 24546 
91165 85013 
61530 21890 
29099 84003 
33573 86182 
10639 49212 
97312 91851 
57682 14067 
5243 69674 
99007 62508 
55...

result:

ok 

Test #118:

score: 20
Accepted
time: 35ms
memory: 60784kb

input:

100000 2 100000
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
5...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #119:

score: 20
Accepted
time: 38ms
memory: 60668kb

input:

99555 2 99555
2 1
3 2
3 4
4 5
6 5
7 6
7 8
8 9
10 9
11 10
11 12
12 13
14 13
15 14
15 16
16 17
18 17
19 18
19 20
20 21
22 21
23 22
23 24
24 25
26 25
27 26
27 28
28 29
30 29
31 30
31 32
32 33
34 33
35 34
35 36
36 37
38 37
39 38
39 40
40 41
42 41
43 42
43 44
44 45
46 45
47 46
47 48
48 49
50 49
51 50
51 ...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #120:

score: 20
Accepted
time: 0ms
memory: 3820kb

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

2 2 2 3 
2 3 3 2 
3 2 2 2 

result:

ok 

Test #121:

score: 20
Accepted
time: 7ms
memory: 5160kb

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:

60 89 29 62 109 89 3 83 125 97 92 119 123 140 13 33 145 104 62 125 57 4 19 5 123 122 155 102 36 154 14 132 60 80 123 145 151 86 125 29 76 122 95 55 36 26 19 9 89 109 102 116 19 128 12 114 155 101 72 66 36 7 97 93 
2 122 27 3 123 10 125 122 4 55 109 47 104 93 29 63 156 60 109 27 123 28 90 119 125 71 ...

result:

ok 

Test #122:

score: 20
Accepted
time: 6ms
memory: 4840kb

input:

9 1024 9
1 6 8 8 4 1 1 5 8 6 8 4 6 6 1 6 6 1 4 4 5 1 6 6 8 6 4 1 1 1 5 8 6 4 1 6 4 8 6 4 1 1 8 1 6 6 8 1 8 8 1 4 1 8 6 5 1 1 6 8 6 4 4 5 1 5 1 8 6 8 8 1 8 5 5 6 1 8 4 6 8 1 1 8 8 1 4 8 6 4 4 8 1 8 1 8 1 1 1 1 8 8 6 4 6 1 1 5 8 4 1 6 5 8 1 6 1 6 4 1 6 5 4 8 4 5 4 6 1 8 6 8 1 4 1 8 6 1 4 1 4 1 5 8 8 1...

output:

1 1 1 8 1 8 6 4 1 1 6 4 1 8 6 5 1 8 1 6 1 8 6 4 1 6 8 5 1 6 4 8 1 8 1 8 1 6 1 4 1 1 6 8 6 5 8 4 1 6 1 6 1 8 5 4 1 1 8 6 8 6 4 5 1 1 1 8 1 4 6 8 1 1 8 6 4 6 8 5 1 1 1 6 6 4 8 5 1 6 4 8 1 6 8 5 1 6 1 8 1 6 8 4 1 1 8 6 5 8 6 4 1 1 8 6 1 4 8 5 1 6 8 4 1 6 8 5 1 1 6 8 1 4 8 6 1 1 8 6 1 8 5 4 1 1 6 8 1 4 ...

result:

ok 

Test #123:

score: 20
Accepted
time: 0ms
memory: 6316kb

input:

2462 4 2401
595 1986 967 1326
19 173 880 2187
961 1645 843 1179
177 1102 1566 1225
1065 1553 961 354
1276 625 611 1814
1110 1097 572 845
780 2178 2041 1291
1531 415 1138 2390
1131 1649 499 584
752 1296 754 1982
2295 498 1627 1853
1647 1628 974 1282
265 2321 1271 2097
1161 123 2252 1776
439 723 487 4...

output:

1986 967 595 1326 
880 19 173 2187 
843 961 1179 1645 
177 1566 1102 1225 
354 1065 1553 961 
1276 1814 611 625 
845 1110 572 1097 
780 1291 2178 2041 
415 1138 2390 1531 
1131 584 499 1649 
752 754 1296 1982 
498 1853 1627 2295 
974 1647 1282 1628 
2097 265 1271 2321 
2252 1161 123 1776 
424 439 48...

result:

ok 

Test #124:

score: 20
Accepted
time: 0ms
memory: 6076kb

input:

4990 2 3
1 2
2 2
1 2
2 2
2 1
1 1
1 2
2 1
2 1
1 1
2 2
1 1
2 2
2 2
2 2
1 2
1 1
2 1
2 1
1 1
2 1
1 1
2 2
1 2
2 1
2 2
1 1
2 2
1 1
1 2
2 2
1 2
1 1
2 1
1 1
2 2
1 2
2 1
2 1
2 2
2 1
2 2
1 1
2 1
1 2
1 2
2 1
1 2
1 2
1 1
2 2
1 2
2 1
1 1
2 2
1 2
1 2
2 2
2 2
1 2
2 1
1 2
1 1
1 1
2 1
1 1
1 2
1 2
2 1
1 2
2 2
1 2
2 2...

output:

1 2 
2 2 
2 1 
2 2 
1 2 
1 1 
2 1 
1 2 
2 1 
1 1 
2 2 
1 1 
2 2 
2 2 
2 2 
1 2 
1 1 
2 1 
1 2 
1 1 
2 1 
1 1 
2 2 
1 2 
2 1 
2 2 
1 1 
2 2 
1 1 
1 2 
2 2 
2 1 
1 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 1 
2 2 
1 2 
2 2 
1 1 
2 1 
1 2 
2 1 
1 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
1 1 
2 2 
2 1 
1 2 
2 2 
2 2 
2 1 
...

result:

ok 

Test #125:

score: 20
Accepted
time: 4ms
memory: 6304kb

input:

5000 2 5000
2970 2674
1208 2674
4977 2674
2674 3028
2674 36
1712 2674
3561 2674
2674 3033
4699 2674
2674 1785
2674 4345
2674 3302
2493 2674
2674 4280
2674 3999
4850 2674
2674 4508
3742 2674
2674 2718
2674 3461
260 2674
2674 4223
2069 2674
2674 1144
1975 2674
527 2674
2674 3260
2806 2674
3636 2674
26...

output:

2674 2970 
2674 1208 
2674 4977 
2674 3028 
2674 36 
2674 1712 
2674 3561 
2674 3033 
2674 4699 
2674 1785 
2674 4345 
2674 3302 
2674 2493 
2674 4280 
2674 3999 
2674 4850 
2674 4508 
2674 3742 
2674 2718 
2674 3461 
2674 260 
2674 4223 
2674 2069 
2674 1144 
2674 1975 
2674 527 
2674 3260 
2674 28...

result:

ok 

Test #126:

score: 20
Accepted
time: 4ms
memory: 6180kb

input:

2450 4 2401
317 417 657 793
1237 1460 1990 507
1030 1744 1155 1114
486 868 1284 2376
2391 704 1441 665
173 1283 789 1607
1309 1045 1466 2192
734 766 284 254
1814 1752 1181 937
1459 1638 1329 2346
1155 1205 443 1744
430 1096 1050 1098
930 2224 1622 186
1772 1916 1833 2196
2066 739 114 757
1180 786 99...

output:

417 793 317 657 
1237 507 1460 1990 
1744 1114 1030 1155 
868 2376 1284 486 
665 704 1441 2391 
789 173 1607 1283 
2192 1045 1309 1466 
766 254 284 734 
1181 1752 1814 937 
1638 2346 1329 1459 
443 1155 1744 1205 
430 1098 1050 1096 
930 186 2224 1622 
1916 1833 1772 2196 
114 2066 739 757 
277 786 ...

result:

ok 

Test #127:

score: 20
Accepted
time: 5ms
memory: 5888kb

input:

1250 8 1000
580 788 926 830 833 861 67 795
768 582 227 113 421 701 823 566
188 868 745 494 910 981 644 76
572 751 409 665 210 771 875 742
131 442 387 298 3 151 455 145
550 78 74 694 250 672 85 118
857 807 977 695 431 855 944 533
523 881 432 789 742 787 649 615
159 29 942 894 619 538 114 42
834 480 6...

output:

861 580 926 67 795 830 788 833 
227 582 823 421 566 768 701 113 
188 494 910 644 981 76 868 745 
210 665 742 751 771 875 572 409 
131 387 3 455 298 442 145 151 
250 74 85 78 118 694 550 672 
944 977 431 807 695 533 855 857 
615 523 789 787 432 881 742 649 
42 619 942 159 29 538 114 894 
28 480 602 6...

result:

ok 

Test #128:

score: 20
Accepted
time: 65ms
memory: 59384kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

59126 27085 
75021 23663 
78883 67175 
3919 90698 
20718 67504 
44011 49374 
3236 1660 
79270 71971 
90540 24502 
9732 54202 
14395 88659 
56600 52635 
17986 21912 
92420 56526 
3472 40254 
20431 64330 
56003 9381 
45529 57750 
9388 45230 
83797 53437 
47526 75562 
63126 45219 
71020 87437 
2016 502...

result:

ok 

Test #129:

score: 20
Accepted
time: 5ms
memory: 5720kb

input:

1248 8 1248
161 598 1246 131 374 981 761 969
119 257 749 837 658 163 674 826
564 891 1166 207 863 733 802 929
233 964 311 507 202 314 77 400
376 1093 71 445 709 408 1247 388
1020 581 966 19 468 403 48 566
1201 785 822 946 479 132 730 703
349 861 731 188 37 1202 18 183
882 126 896 333 614 1226 648 52...

output:

981 969 161 1246 131 598 374 761 
749 826 658 119 837 257 674 163 
863 891 929 207 802 1166 733 564 
77 233 314 507 311 964 400 202 
71 709 388 1093 376 445 408 1247 
966 581 566 403 1020 19 468 48 
703 1201 946 479 785 132 822 730 
37 861 183 188 1202 731 18 349 
126 896 648 614 882 523 1226 333 
1...

result:

ok 

Test #130:

score: 20
Accepted
time: 5ms
memory: 6112kb

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

2334 475 1156 540 
750 2421 1328 2439 
471 2007 1051 1792 
1776 2269 705 786 
1622 1277 1674 755 
603 1378 590 1217 
1920 967 239 1658 
857 1589 78 2307 
861 2322 1634 2172 
1381 2077 2021 2179 
345 2126 1547 1126 
994 412 1477 1214 
1857 831 978 2085 
281 2174 2406 1844 
1779 521 2254 2334 
1903 90...

result:

ok 

Test #131:

score: 20
Accepted
time: 4ms
memory: 6012kb

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 2 3 2 
1429 1 1 1429 
3 4 7 4 
1430 3 1430 3 
5 6 6 1 
1431 5 1431 5 
7 8 11 8 
1432 7 1432 7 
9 10 5 10 
1433 9 9 1433 
11 12 15 12 
1434 11 1434 11 
13 14 14 9 
1435 13 1435 13 
15 16 19 16 
1436 15 1436 15 
17 18 13 18 
1437 17 17 1437 
19 20 23 20 
1438 19 1438 19 
21 22 22 17 
1439 21 1439 21...

result:

ok 

Test #132:

score: 20
Accepted
time: 4ms
memory: 6480kb

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

2773 3581 
462 1582 
1171 208 
4865 74 
10 1018 
2532 1962 
1491 578 
1140 4567 
4785 3640 
3325 1051 
2135 4545 
1152 286 
309 4874 
3646 1953 
234 1794 
3529 1223 
3751 1002 
4740 3427 
4638 2554 
933 1988 
3177 1846 
2671 2440 
1315 3502 
1382 2669 
443 3145 
438 2418 
420 1154 
3875 671 
3152 18...

result:

ok 

Test #133:

score: 20
Accepted
time: 3ms
memory: 6420kb

input:

4900 2 4900
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
11 10
12 11
13 12
14 13
15 14
16 15
17 16
18 17
19 18
20 19
21 20
22 21
23 22
24 23
25 24
26 25
27 26
28 27
29 28
30 29
31 30
32 31
33 32
34 33
35 34
36 35
37 36
38 37
39 38
40 39
41 40
42 41
43 42
44 43
45 44
46 45
47 46
48 47
49 48
50 49
51 50
52 51...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #134:

score: 20
Accepted
time: 0ms
memory: 6420kb

input:

4900 2 4900
2 1
3 2
3 4
4 5
6 5
7 6
7 8
8 9
10 9
11 10
11 12
12 13
14 13
15 14
15 16
16 17
18 17
19 18
19 20
20 21
22 21
23 22
23 24
24 25
26 25
27 26
27 28
28 29
30 29
31 30
31 32
32 33
34 33
35 34
35 36
36 37
38 37
39 38
39 40
40 41
42 41
43 42
43 44
44 45
46 45
47 46
47 48
48 49
50 49
51 50
51 52...

output:

1 2 
2 3 
3 4 
4 5 
5 6 
6 7 
7 8 
8 9 
9 10 
10 11 
11 12 
12 13 
13 14 
14 15 
15 16 
16 17 
17 18 
18 19 
19 20 
20 21 
21 22 
22 23 
23 24 
24 25 
25 26 
26 27 
27 28 
28 29 
29 30 
30 31 
31 32 
32 33 
33 34 
34 35 
35 36 
36 37 
37 38 
38 39 
39 40 
40 41 
41 42 
42 43 
43 44 
44 45 
45 46 
46...

result:

ok 

Test #135:

score: 20
Accepted
time: 386ms
memory: 118336kb

input:

62400 8 62400
617 61873 50005 41067 20321 15682 32071 28672
22133 8305 52336 45992 33172 47471 17329 39927
42134 45570 15289 42551 55858 19194 10715 10649
8176 5735 13244 20965 61861 7073 12818 5527
21000 8783 29108 17636 58752 9701 42134 11867
35793 5665 25545 53912 41719 7606 30422 4734
6540 43594...

output:

50005 32071 15682 617 41067 61873 28672 20321 
17329 52336 22133 47471 8305 45992 33172 39927 
55858 42134 15289 10649 42551 10715 19194 45570 
20965 5527 61861 5735 7073 12818 8176 13244 
29108 9701 11867 21000 58752 42134 8783 17636 
5665 41719 53912 4734 7606 35793 25545 30422 
8033 4918 60834 43...

result:

ok 

Test #136:

score: 20
Accepted
time: 380ms
memory: 75252kb

input:

488 1024 488
437 386 352 3 204 235 111 327 270 195 436 108 324 319 398 484 177 270 133 272 484 202 67 380 1 215 36 327 104 412 432 67 157 455 286 196 62 262 437 4 289 108 272 402 136 265 291 48 135 182 385 319 112 186 70 50 273 196 231 195 17 319 178 270 132 424 78 406 324 346 57 71 97 186 396 422 3...

output:

1 298 303 272 274 195 67 219 327 478 184 172 57 74 466 296 240 62 156 486 357 119 448 22 45 78 347 352 415 367 214 376 4 432 346 340 272 283 238 286 303 62 290 438 205 72 324 258 365 156 44 437 170 255 108 319 13 388 130 271 353 202 236 252 195 448 259 258 231 346 62 471 8 402 240 52 286 406 388 376...

result:

ok 

Test #137:

score: 20
Accepted
time: 66ms
memory: 16928kb

input:

6 16384 6
2 5 1 6 5 2 5 1 6 1 5 5 6 5 5 6 2 6 2 1 6 6 5 5 6 5 2 2 1 1 1 6 5 1 5 6 6 2 6 1 2 6 6 2 2 1 6 6 6 1 5 5 1 5 5 6 2 5 1 5 1 5 1 2 5 1 1 6 5 6 5 2 1 1 6 1 6 6 5 5 5 1 5 6 2 5 6 5 5 6 6 6 2 5 5 6 2 5 6 1 5 6 6 2 2 5 1 2 5 5 6 5 6 6 1 1 2 2 5 5 6 5 6 5 5 1 6 6 6 6 1 6 5 6 5 2 6 6 6 5 5 6 6 6 6 ...

output:

1 1 6 5 5 6 5 2 1 6 5 2 5 6 6 2 1 5 6 2 1 6 6 5 1 5 5 6 6 5 6 2 1 5 1 6 5 6 6 2 1 5 5 6 6 2 6 5 1 6 5 6 6 5 5 2 1 6 5 2 6 5 5 2 1 5 1 6 6 5 6 2 1 6 5 6 6 5 5 2 1 6 1 5 5 6 5 2 1 5 6 2 5 6 5 2 1 5 5 6 1 5 6 2 1 6 5 2 5 6 5 6 1 6 5 6 5 6 5 2 1 5 6 2 5 6 6 2 1 2 5 6 1 6 6 5 1 6 5 2 5 6 5 2 1 6 5 6 1 6 ...

result:

ok 

Test #138:

score: 20
Accepted
time: 115ms
memory: 36100kb

input:

6035 32 3126
2384 1507 1419 2790 466 3034 613 391 1142 1913 2728 1770 1249 2719 457 1720 2670 541 568 1711 1147 1498 2929 1920 2067 351 2089 1076 3001 2562 2615 1630
1719 1848 849 3098 1026 1016 2612 2228 526 2395 1808 1898 1626 2249 2857 1473 2360 2448 1450 1045 55 2166 2597 1586 1181 540 789 612 1...

output:

391 457 2562 1913 1147 1249 1920 541 2384 1630 466 1076 1770 2790 568 2067 2929 3034 1498 3001 1720 1507 2719 1711 2089 2615 2670 1419 613 351 2728 1142 
1808 2448 789 1026 2828 1626 1045 2597 540 2612 841 1848 2857 2395 2166 3098 1181 849 526 2228 1579 612 1719 1016 55 1450 1586 2249 1473 2360 335 ...

result:

ok 

Test #139:

score: 20
Accepted
time: 69ms
memory: 52068kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

13223 16598 
19981 18759 
2642 8681 
4102 18080 
16749 11473 
690 15290 
16229 17900 
10684 17481 
12171 6328 
1150 9417 
7185 5689 
10346 17102 
9727 17958 
2117 13756 
10955 13157 
245 2840 
5337 5257 
6429 16622 
10772 17516 
19349 13007 
11359 2821 
8897 14341 
3974 2482 
17966 16241 
15458 1814...

result:

ok 

Test #140:

score: 20
Accepted
time: 302ms
memory: 67380kb

input:

442 1024 442
204 189 272 54 225 232 246 111 211 39 140 31 133 213 40 172 5 229 225 147 176 81 31 108 40 148 128 210 21 262 105 163 228 247 259 161 184 211 3 211 261 277 70 186 27 195 89 282 233 258 169 215 154 267 21 239 264 213 91 131 295 39 163 282 254 63 286 282 9 116 139 285 76 206 85 233 73 180...

output:

1 228 115 72 236 138 8 165 124 89 141 106 225 100 73 76 262 6 223 242 49 206 112 181 51 297 184 268 210 134 239 131 266 53 198 156 40 52 252 123 175 11 161 70 208 285 121 15 17 41 155 165 163 13 152 172 96 255 240 251 47 118 82 249 267 11 194 33 281 140 181 147 85 56 81 139 8 179 289 229 233 69 94 1...

result:

ok 

Test #141:

score: 20
Accepted
time: 351ms
memory: 108576kb

input:

59767 8 50000
14021 37442 6924 2683 26908 28108 49331 4157
37602 8443 19287 12234 4215 29554 33860 1201
2453 34206 48003 47930 30310 48979 24906 2040
19079 30112 42351 26155 23394 37361 37618 35224
18576 29106 48671 22449 25578 19435 4011 7931
7174 13442 3382 24117 23309 31964 19031 45122
33083 3854...

output:

37442 2683 4157 28108 26908 49331 14021 6924 
29554 33860 19287 8443 1201 4215 12234 37602 
2040 48979 2453 48003 30310 24906 47930 34206 
19079 26155 37361 35224 30112 42351 37618 23394 
7931 22449 18576 19435 29106 48671 25578 4011 
19031 13442 23309 3382 24117 31964 7174 45122 
22862 45872 49016 ...

result:

ok 

Test #142:

score: 20
Accepted
time: 415ms
memory: 118756kb

input:

62500 8 62500
51504 53517 18444 47810 55743 52115 39033 39945
39582 40153 48723 405 57762 57932 38589 34957
46544 29639 46926 5502 36080 4497 12837 5415
40364 54270 15841 56968 20512 49512 23271 29535
32613 29997 43963 8109 43144 40423 38621 31273
32431 16718 11192 30443 19278 38857 30834 60796
1958...

output:

18444 51504 55743 39945 47810 52115 53517 39033 
48723 34957 39582 57932 38589 405 57762 40153 
5415 36080 29639 5502 4497 46544 46926 12837 
49512 54270 15841 29535 23271 56968 20512 40364 
8109 31273 29997 43144 40423 32613 38621 43963 
19278 30834 11192 16718 38857 30443 60796 32431 
16527 19582 ...

result:

ok 

Test #143:

score: 20
Accepted
time: 380ms
memory: 73864kb

input:

61 8192 61
47 47 47 47 47 36 36 47 36 36 36 47 36 47 36 47 47 36 36 36 47 36 36 36 47 36 47 47 47 36 47 36 36 47 47 36 47 47 47 47 47 47 36 36 36 47 47 21 36 36 36 36 47 47 36 47 36 47 47 47 36 47 47 47 47 36 36 47 36 47 36 47 47 36 47 47 36 47 47 36 36 36 36 36 47 36 36 36 36 47 36 47 36 47 47 36 3...

output:

1 47 47 36 36 47 47 36 36 47 36 47 47 36 36 47 36 15 47 36 36 47 47 36 36 47 47 36 36 47 36 47 36 47 47 36 47 36 36 47 36 47 47 36 47 36 36 47 47 36 47 36 47 21 36 47 36 47 47 36 47 36 36 47 36 47 36 47 36 47 36 47 47 36 36 47 36 30 47 36 47 36 47 36 36 47 36 47 36 47 47 36 36 47 36 47 47 36 47 36 3...

result:

ok 

Test #144:

score: 20
Accepted
time: 317ms
memory: 61064kb

input:

50 8192 50
40 29 20 40 40 40 20 40 40 40 40 49 20 20 40 40 20 40 40 20 20 20 40 20 40 40 20 20 40 40 40 40 40 20 40 40 40 40 40 40 20 40 20 40 20 40 40 20 40 40 20 20 40 20 40 40 20 40 40 40 20 19 40 40 40 40 20 40 20 40 20 20 20 20 20 20 20 40 20 40 20 20 20 40 40 40 40 40 40 40 20 20 40 20 20 40 4...

output:

1 40 20 40 40 20 40 20 40 20 40 20 40 20 40 20 20 40 40 20 40 20 40 20 20 40 20 40 40 20 40 20 16 40 20 40 20 40 40 20 40 20 40 20 40 20 40 20 40 20 20 40 40 20 40 20 40 20 40 20 20 40 40 20 20 40 40 20 40 20 40 40 40 20 40 20 40 20 40 20 40 20 40 20 40 20 5 20 20 40 40 20 40 20 40 20 40 20 40 20 40...

result:

ok 

Test #145:

score: 20
Accepted
time: 327ms
memory: 102388kb

input:

56000 8 50000
38540 29053 29109 38746 29288 38450 43383 32332
14057 662 19282 8910 49216 18920 32722 25913
4461 24280 3328 17870 569 37854 3246 27991
35958 21836 18035 12840 25641 36792 21982 33634
6456 49901 35635 42812 24541 44145 8939 11926
29442 26462 18739 27152 42797 5777 15117 19193
40156 501...

output:

29109 43383 29288 29053 38540 38746 32332 38450 
49216 25913 14057 19282 662 18920 8910 32722 
3328 24280 569 3246 17870 4461 37854 27991 
35958 36792 18035 21982 33634 25641 21836 12840 
6456 11926 42812 24541 44145 8939 49901 35635 
27152 19193 42797 29442 15117 18739 26462 5777 
45047 34145 20160...

result:

ok 

Test #146:

score: 20
Accepted
time: 392ms
memory: 114608kb

input:

61952 8 61952
31143 31143 3756 34556 4617 49727 3756 48229
48054 10150 10150 1113 46750 1113 11148 44687
18150 50774 34447 50642 31286 44185 50642 18150
18803 8000 20838 21039 20764 18803 20764 56246
59196 9154 49057 7963 47927 59196 59996 7963
27925 33037 27925 25590 4557 12519 33037 21779
9336 551...

output:

31143 34556 3756 49727 31143 48229 3756 4617 
46750 10150 1113 11148 44687 10150 1113 48054 
44185 18150 34447 50642 31286 50774 18150 50642 
56246 20838 20764 18803 8000 18803 20764 21039 
49057 59196 7963 47927 7963 59196 9154 59996 
33037 27925 27925 4557 33037 12519 25590 21779 
9336 1848 1425 5...

result:

ok 

Test #147:

score: 20
Accepted
time: 139ms
memory: 100824kb

input:

99995 4 99995
1 2 28571 28571
2 4 28572 28572
3 1 28573 28573
4 6 28574 28574
5 3 28575 28575
6 8 28576 28576
7 5 28577 28577
8 10 28578 28578
9 7 28579 28579
10 12 28580 28580
11 9 28581 28581
12 14 28582 28582
13 11 28583 28583
14 16 28584 28584
15 13 28585 28585
16 18 28586 28586
17 15 28587 2858...

output:

1 28571 28571 2 
2 28572 28572 4 
3 28573 1 28573 
4 28574 28574 6 
5 28575 28575 3 
6 28576 28576 8 
7 28577 5 28577 
8 28578 28578 10 
9 28579 28579 7 
10 28580 28580 12 
11 28581 9 28581 
12 28582 28582 14 
13 28583 28583 11 
14 28584 28584 16 
15 28585 13 28585 
16 28586 28586 18 
17 28587 28587...

result:

ok 

Test #148:

score: 20
Accepted
time: 152ms
memory: 101140kb

input:

99995 4 99995
1 2 2 3
57141 1 1 57141
3 4 4 7
57142 3 3 57142
5 6 6 1
57143 5 5 57143
7 8 8 11
57144 7 7 57144
9 10 10 5
57145 9 9 57145
11 12 12 15
57146 11 11 57146
13 14 14 9
57147 13 13 57147
15 16 16 19
57148 15 15 57148
17 18 18 13
57149 17 17 57149
19 20 20 23
57150 19 19 57150
21 22 22 17
57...

output:

1 2 3 2 
57141 1 1 57141 
3 4 7 4 
57142 3 57142 3 
5 6 6 1 
57143 5 57143 5 
7 8 11 8 
57144 7 57144 7 
9 10 5 10 
57145 9 9 57145 
11 12 15 12 
57146 11 57146 11 
13 14 14 9 
57147 13 57147 13 
15 16 19 16 
57148 15 57148 15 
17 18 13 18 
57149 17 17 57149 
19 20 23 20 
57150 19 57150 19 
21 22 22...

result:

ok 

Test #149:

score: 20
Accepted
time: 134ms
memory: 100684kb

input:

99995 4 99995
71425 71425 99994 99995
71424 71424 99992 99994
71423 71423 99995 99993
71422 71422 99990 99992
71421 71421 99993 99991
71420 71420 99988 99990
71419 71419 99991 99989
71418 71418 99986 99988
71417 71417 99989 99987
71416 71416 99984 99986
71415 71415 99987 99985
71414 71414 99982 9998...

output:

71425 99994 71425 99995 
71424 99992 71424 99994 
99995 71423 71423 99993 
71422 99990 71422 99992 
71421 99993 71421 99991 
71420 99988 71420 99990 
99991 71419 71419 99989 
71418 99986 71418 99988 
71417 99989 71417 99987 
71416 99984 71416 99986 
99987 71415 71415 99985 
71414 99982 71414 99984 
...

result:

ok 

Test #150:

score: 20
Accepted
time: 39ms
memory: 55060kb

input:

99006 2 11
7 2
3 10
10 8
1 8
5 2
3 6
6 3
5 3
6 8
7 7
4 7
1 3
7 6
10 5
6 4
9 9
8 4
2 9
6 1
10 7
10 1
9 7
6 9
6 9
3 10
10 10
6 2
7 7
6 5
3 8
4 4
5 2
5 8
8 2
10 9
8 3
7 4
2 2
8 9
8 10
8 9
2 1
1 5
4 7
4 9
6 9
8 10
2 4
6 3
4 1
2 10
3 5
10 7
7 1
4 10
6 6
1 4
4 8
10 9
3 9
5 5
6 1
9 2
2 7
9 5
9 8
1 3
5 6
7 ...

output:

2 7 
10 3 
8 10 
1 8 
5 2 
3 6 
6 3 
3 5 
6 8 
7 7 
7 4 
1 3 
7 6 
10 5 
4 6 
9 9 
8 4 
9 2 
6 1 
7 10 
10 1 
9 7 
6 9 
6 9 
3 10 
10 10 
2 6 
7 7 
5 6 
8 3 
4 4 
2 5 
5 8 
8 2 
10 9 
3 8 
4 7 
2 2 
9 8 
8 10 
8 9 
1 2 
1 5 
4 7 
9 4 
6 9 
10 8 
2 4 
3 6 
4 1 
10 2 
5 3 
7 10 
1 7 
10 4 
6 6 
4 1 
8...

result:

ok 

Test #151:

score: 20
Accepted
time: 131ms
memory: 101068kb

input:

99995 4 99995
99993 99994 99994 99995
42855 99995 99995 42855
99989 99992 99992 99993
42854 99993 99993 42854
99995 99990 99990 99991
42853 99991 99991 42853
99985 99988 99988 99989
42852 99989 99989 42852
99991 99986 99986 99987
42851 99987 99987 42851
99981 99984 99984 99985
42850 99985 99985 4285...

output:

99994 99995 99994 99993 
99995 42855 42855 99995 
99992 99993 99992 99989 
99993 42854 99993 42854 
99990 99991 99995 99990 
99991 42853 99991 42853 
99988 99989 99988 99985 
99989 42852 99989 42852 
99986 99987 99986 99991 
99987 42851 42851 99987 
99984 99985 99984 99981 
99985 42850 99985 42850 
...

result:

ok 

Test #152:

score: 20
Accepted
time: 132ms
memory: 102096kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

71425 85710 71425 85710 
85709 71424 71424 85709 
85708 71423 71423 85708 
85707 71422 71422 85707 
71421 85706 71421 85706 
85705 71420 71420 85705 
85704 71419 71419 85704 
85703 71418 71418 85703 
71417 85702 71417 85702 
85701 71416 71416 85701 
85700 71415 71415 85700 
85699 71414 71414 85699 
...

result:

ok 

Test #153:

score: 20
Accepted
time: 138ms
memory: 106328kb

input:

99995 4 99995
71425 71425 85710 85710
71424 71424 85709 85709
71423 71423 85708 85708
71422 71422 85707 85707
71421 71421 85706 85706
71420 71420 85705 85705
71419 71419 85704 85704
71418 71418 85703 85703
71417 71417 85702 85702
71416 71416 85701 85701
71415 71415 85700 85700
71414 71414 85699 8569...

output:

85710 71425 71425 85710 
71424 85709 71424 85709 
71423 85708 71423 85708 
71422 85707 71422 85707 
85706 71421 71421 85706 
71420 85705 71420 85705 
71419 85704 71419 85704 
71418 85703 71418 85703 
85702 71417 71417 85702 
71416 85701 71416 85701 
71415 85700 71415 85700 
71414 85699 71414 85699 
...

result:

ok 

Test #154:

score: 20
Accepted
time: 150ms
memory: 102124kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
14287 28572 14287 28572 
14288 28573 14288 28573 
14289 28574 14289 28574 
14290 28575 28575 14290 
14291 28576 14291 28576 
14292 28577 14292 28577 
14293 28578 14293 28578 
14294 28579 28579 14294 
14295 28580 14295 28580 
14296 28581 14296 28581 
14297 28582 14297 28582 
...

result:

ok 

Test #155:

score: 20
Accepted
time: 150ms
memory: 110212kb

input:

99995 4 99995
14286 14286 28571 28571
14287 14287 28572 28572
14288 14288 28573 28573
14289 14289 28574 28574
14290 14290 28575 28575
14291 14291 28576 28576
14292 14292 28577 28577
14293 14293 28578 28578
14294 14294 28579 28579
14295 14295 28580 28580
14296 14296 28581 28581
14297 14297 28582 2858...

output:

14286 28571 28571 14286 
14287 28572 14287 28572 
14288 28573 14288 28573 
14289 28574 14289 28574 
14290 28575 28575 14290 
14291 28576 14291 28576 
14292 28577 14292 28577 
14293 28578 14293 28578 
14294 28579 28579 14294 
14295 28580 14295 28580 
14296 28581 14296 28581 
14297 28582 14297 28582 
...

result:

ok 

Test #156:

score: 20
Accepted
time: 192ms
memory: 96780kb

input:

62496 8 62496
1 1 2 2 17857 17857 17857 17857
2 2 4 4 17858 17858 17858 17858
3 3 1 1 17859 17859 17859 17859
4 4 6 6 17860 17860 17860 17860
5 5 3 3 17861 17861 17861 17861
6 6 8 8 17862 17862 17862 17862
7 7 5 5 17863 17863 17863 17863
8 8 10 10 17864 17864 17864 17864
9 9 7 7 17865 17865 17865 17...

output:

1 17857 2 17857 1 17857 2 17857 
2 17858 4 17858 2 17858 4 17858 
3 17859 1 17859 3 17859 1 17859 
4 17860 6 17860 4 17860 6 17860 
5 17861 3 17861 5 17861 3 17861 
6 17862 8 17862 6 17862 8 17862 
7 17863 5 17863 7 17863 5 17863 
8 17864 10 17864 8 17864 10 17864 
9 17865 7 17865 9 17865 7 17865 
1...

result:

ok 

Test #157:

score: 20
Accepted
time: 207ms
memory: 99628kb

input:

62496 8 62496
1 3 2 2 2 2 1 3
35713 35713 1 1 1 1 35713 35713
3 7 4 4 4 4 3 7
35714 35714 3 3 3 3 35714 35714
5 1 6 6 6 6 5 1
35715 35715 5 5 5 5 35715 35715
7 11 8 8 8 8 7 11
35716 35716 7 7 7 7 35716 35716
9 5 10 10 10 10 9 5
35717 35717 9 9 9 9 35717 35717
11 15 12 12 12 12 11 15
35718 35718 11 1...

output:

1 2 2 3 1 2 2 3 
35713 1 1 35713 35713 1 1 35713 
3 4 4 7 3 4 4 7 
35714 3 3 35714 35714 3 3 35714 
5 6 6 1 5 6 6 1 
35715 5 5 35715 35715 5 5 35715 
7 8 8 11 7 8 8 11 
35716 7 7 35716 35716 7 7 35716 
9 10 10 5 9 10 10 5 
35717 9 9 35717 35717 9 9 35717 
11 12 12 15 11 12 12 15 
35718 11 11 35718 3...

result:

ok 

Test #158:

score: 20
Accepted
time: 64ms
memory: 60096kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

53479 25002 
53479 63606 
53479 40735 
53479 83340 
53479 40775 
53479 11458 
53479 8684 
53479 60405 
53479 45116 
53479 67722 
53479 26014 
53479 87860 
53479 55147 
53479 22726 
53479 67769 
53479 129 
53479 14600 
53479 21514 
53479 32164 
53479 60088 
53479 25415 
53479 70946 
53479 27091 
5347...

result:

ok 

Test #159:

score: 20
Accepted
time: 80ms
memory: 60516kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

66963 8483 
63660 79073 
41795 20397 
84311 1296 
3690 21178 
21052 31611 
51423 14323 
34208 82468 
2785 83835 
50594 28274 
10993 59957 
34259 64334 
73934 89407 
61083 14947 
53201 89472 
33351 61243 
76632 58718 
67464 85318 
45096 54224 
84552 76529 
44253 30697 
43669 3108 
64691 26489 
85776 ...

result:

ok 

Test #160:

score: 20
Accepted
time: 68ms
memory: 51812kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

83824 80944 
25208 26621 
57146 28836 
18169 43915 
47842 59242 
34224 78881 
20722 38791 
89723 91046 
40306 72800 
92681 94906 
41151 7263 
76035 13332 
93928 38800 
97168 86055 
44186 73623 
7391 68071 
72265 20692 
42596 44111 
36037 77687 
836 64592 
35187 43568 
34861 88539 
37477 22111 
85787...

result:

ok 

Test #161:

score: 20
Accepted
time: 67ms
memory: 60920kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

91980 92592 
10704 12359 
56718 35873 
20301 28601 
78422 55548 
59974 74736 
81664 29025 
55916 70432 
34185 47381 
31764 56168 
30947 33997 
9029 70076 
52532 67057 
79680 99273 
54410 56704 
71652 45238 
12615 6894 
78041 66478 
40520 5451 
58133 5950 
89237 70551 
36028 97551 
83553 90630 
15211...

result:

ok 

Test #162:

score: 20
Accepted
time: 61ms
memory: 61328kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

40457 79301 
80634 40457 
21580 49074 
14354 92701 
70461 44540 
47637 47132 
27979 84954 
60683 87556 
22633 43063 
49914 63643 
3571 4494 
88758 53632 
50019 17055 
79039 49334 
50111 67659 
48061 17945 
84596 60323 
14629 72033 
30069 77184 
36217 64209 
35279 49947 
45866 44707 
58146 58484 
533...

result:

ok 

Subtask #9:

score: 0
Skipped

Dependency #3:

0%

Subtask #10:

score: 0
Skipped

Dependency #1:

0%