QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#758048#5416. Fabulous Fungus FrenzyMitsubachiWA 8ms4012kbC++146.4kb2024-11-17 15:20:312024-11-17 15:20:36

Judging History

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

  • [2024-11-17 15:20:36]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:4012kb
  • [2024-11-17 15:20:31]
  • 提交

answer

// g++-13 1.cpp -std=c++17 -O2 -I .
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;

// #include <atcoder/segtree>
// using namespace atcoder;

using ll = long long;
using ld = long double;
 
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;
 
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())

random_device seed;
mt19937_64 randint(seed());

ll grr(ll mi, ll ma) { // [mi, ma)
    return mi + randint() % (ma - mi);
}

int kind=63;

struct stamp{
  int n;
  int m;
  vst g;
  vi cnt;
  int ind;
};

bool comp(stamp &l,stamp &r){
  if(l.n*l.m!=r.n*r.m){
    return (l.n*l.m)<(r.n*r.m);
  }
  return l.ind<r.ind;
}

// # a b c ... z A B C ... Z 0 1 2 ... 9 
int code(char c){
  if(c=='#')return 0;
  if('a'<=c&&c<='z')return 1+(c-'a');
  if('A'<=c&&c<='Z')return 27+(c-'A');
  if('0'<=c&&c<='9')return 53+(c-'0');
  cerr<<"ERROR in code(char c)"<<" : "<<c<<endl;
  return -1;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n,m,k;cin>>n>>m>>k;

  vector<stamp> s(k+1);
  vst init;

  {
    vst g(n);
    rep(i,0,n)cin>>g[i];
    vi cnt(kind);
    rep(i,0,n)rep(j,0,m)cnt[code(g[i][j])]++;
    s[0]={n,m,g,cnt,0};
    init=g;
  }

  vst tar(n);
  rep(i,0,n)cin>>tar[i];

  rep(t,0,k){
    int nt,mt;cin>>nt>>mt;
    vst g(nt);
    rep(i,0,nt)cin>>g[i];
    vi cnt(kind);
    rep(i,0,nt)rep(j,0,mt)cnt[code(g[i][j])]++;
    s[t+1]={nt,mt,g,cnt,(int)t+1};
  }

  sort(all(s),comp);

  // rep(i,0,k+1){
  //   cout<<s[i].n<<" "<<s[i].m<<" "<<s[i].ind<<endl;
  //   rep(j,0,s[i].n){
  //     cout<<s[i].g[j]<<endl;
  //   }
  // }

  vst nw=tar;
  int flg=0;
  vector<tuple<int,int,int>> op;

  // cout<<"start op"<<endl;

  rep(i,0,n*m){
    // cout<<"now state"<<endl;
    // rep(j,0,n)cout<<nw[j]<<endl;
    // cout<<endl;

    vi cnt(kind,0);
    rep(j,0,n)rep(k,0,m){
      cnt[code(nw[j][k])]++;
    }
    if(cnt[0]==n*m){
      flg=1;
      break;
    }

    int use=-1;
    per(f,k,0){
      int nd=0;
      rep(j,1,kind){
        int p=cnt[j],q=s[f].cnt[j];
        nd+=max(q-p,0);
      }
      if(nd>cnt[0]||s[f].n*s[f].m-nd==0){
        continue;
      }
      use=s[f].ind;

      // cout<<f<<" = use"<<endl;
      // cout<<s[f].n<<" &&& "<<s[f].m<<endl;
      // rep(w,0,s[f].n)cout<<s[f].g[w]<<endl;

      vi sm(kind,0);
      rep(j,0,s[f].n){
        rep(k,0,s[f].m){
          // cout<<"fij = "<<f<<" "<<s[f].g[j][k]<<endl;
          int id=code(s[f].g[j][k]);
          int tar;
          // cout<<id<<" "<<sm[id]<<" :: "<<cnt[id]<<endl;
          if(sm[id]<cnt[id])tar=id;
          else tar=0;

          // nw[j][k] を tar にしたい
          if(code(nw[j][k])==tar){
            if(i==1&&init[0]=="6SCG0JDRlzxfS8EHKcMD"&&j==17&&k==2){
              cout<<"continue"<<endl;
              cout<<j<<" "<<k<<" ----> "<<tar<<" = tar"<<endl;
              cout<<nw[j][k]<<" "<<s[f].g[j][k]<<endl;
            }
            continue;
          }

          if(i==1&&init[0]=="6SCG0JDRlzxfS8EHKcMD"&&j==17&&k==2){
            cout<<"not continue"<<endl;
            cout<<j<<" "<<k<<" ----> "<<tar<<" = tar"<<endl;
            cout<<nw[j][k]<<" "<<s[f].g[j][k]<<endl;
            cout<<sm[tar]<<" "<<cnt[tar]<<endl;
            rep(p,0,n)rep(q,0,m){
              if(code(nw[p][q])==tar){
                cout<<"( "<<p<<", "<<q<<") "<<s[f].g[p][q]<<" ";
              }
            }
            cout<<endl;
          }

          // cout<<j<<" "<<k<<" ----> "<<tar<<" = tar"<<endl;


          int change=0;
          rep(sj,0,n){
            rep(sk,0,m){
              if(change)break;
              if(sj<j&&sk<s[f].m)continue;
              if(sj==j&&sk<k)continue;
              if(code(nw[sj][sk])==tar){
                // (sj, sk) -> (j, k)
                if(i==1&&init[0]=="6SCG0JDRlzxfS8EHKcMD"&&j==17&&k==2){
                  cout<<"fix"<<endl;
                  cout<<j<<" "<<k<<" ----> "<<tar<<" = tar"<<endl;
                  cout<<sj<<" "<<sk<<" --> "<<j<<" "<<k<<endl;
                  cout<<nw[sj][sk]<<" "<<s[f].g[j][k]<<endl;
                }
                // cout<<sj<<" "<<sk<<" --> "<<j<<" "<<k<<endl;
                int nj=sj,nk=sk;
                while(nj!=j||nk!=k){
                  if(nj<j){
                    op.emplace_back(-3,nj,nk);
                    swap(nw[nj][nk],nw[nj+1][nk]);
                    nj++;
                  }
                  else if(nk<k){
                    op.emplace_back(-1,nj,nk);
                    swap(nw[nj][nk],nw[nj][nk+1]);
                    nk++;
                  }
                  else if(j<nj){
                    op.emplace_back(-3,nj-1,nk);
                    swap(nw[nj][nk],nw[nj-1][nk]);
                    nj--;
                  }
                  else{
                    op.emplace_back(-1,nj,nk-1);
                    swap(nw[nj][nk],nw[nj][nk-1]);
                    nk--;
                  }
                }
                change=1;
                break;
              }
            }
          }

          sm[id]++;
        }
      }

      rep(j,0,s[f].n){
        rep(k,0,s[f].m){
          if(nw[j][k]!=s[f].g[j][k]&&nw[j][k]!='#'){
            cout<<"ERROR in fix"<<endl;
            cout<<"step "<<i<<" :: "<<j<<" "<<k<<" "<<nw[j][k]<<" "<<s[f].g[j][k]<<endl;
            cout<<f<<" "<<s[f].n<<" "<<s[f].m<<endl;
          }
          nw[j][k]='#';
        }
      }

      if(use!=0)op.emplace_back(use,0,0);

      break;
    }

    if(use==-1){
      cout<<-1<<endl;
      return 0;
    }
  }

  reverse(all(op));
  cout<<op.size()<<endl;
  for(auto [o,x,y]:op){
    cout<<o<<" "<<x+1<<" "<<y+1<<endl;
  }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3572kb

input:

3 3 1
OOO
GOG
BGB

OOO
GGG
BBB

3 1
B
G
B

output:

13
-1 3 1
-3 2 3
-1 3 2
-1 2 1
-3 1 3
-1 2 2
-1 1 2
-1 1 1
1 1 1
-1 3 1
-1 2 1
-3 1 1
-3 2 1

result:

ok puzzle solved

Test #2:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

2 2 1
OO
OO

PP
PP

1 2
OP

output:

-1

result:

ok puzzle solved

Test #3:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

4 8 4
11122222
33344444
55556666
77777777

NIxSHUOx
DExDUIxx
DANxSHIx
YUANSHEN

2 3
NIy
DEx

3 8
zzzzzzzz
DANNSH9I
YUA9SHEN

1 1
x

2 5
SHO8y
DUUI8

output:

102
1 1 1
-1 2 3
-1 2 4
-1 2 5
-1 2 6
-1 2 7
-3 2 8
-3 3 8
1 1 1
-1 2 3
-1 2 4
-1 2 5
-1 2 6
-3 2 7
-3 3 7
1 1 1
-1 2 3
-1 2 4
-1 2 5
-3 2 6
-3 3 6
1 1 1
-1 2 3
-1 2 4
-3 2 5
-3 3 5
1 1 1
-1 2 3
-3 2 4
-3 3 4
2 1 1
-3 3 8
-3 3 7
-3 3 6
-3 3 5
-3 3 3
-3 3 2
-3 3 1
-3 2 8
-1 3 7
-1 3 6
-3 2 7
-1 3 6
-...

result:

ok puzzle solved

Test #4:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

2 2 1
OO
OO

OP
PP

1 2
PP

output:

8
-1 1 1
-3 1 2
1 1 1
-3 1 1
1 1 1
-3 1 2
-1 2 1
-1 1 1

result:

ok puzzle solved

Test #5:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

2 2 1
OO
OO

OP
PO

2 1
P
P

output:

4
-3 1 2
-1 1 1
1 1 1
-1 1 1

result:

ok puzzle solved

Test #6:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

2 2 1
OO
OO

OP
PO

2 2
PP
PP

output:

-1

result:

ok puzzle solved

Test #7:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 2 1
OO
OO

OP
PP

1 2
OP

output:

7
1 1 1
-3 1 2
-1 2 1
1 1 1
-3 1 2
-1 2 1
1 1 1

result:

ok puzzle solved

Test #8:

score: 0
Accepted
time: 4ms
memory: 3960kb

input:

20 20 20
bofelagiqboebdqplbhq
qsrksfthhptcmikjohkt
qrnhpoatbekggnkdonet
aoalekbmpbisgflbhmol
djnhnlitcakltqgegqrt
fdctfarsmbnbeosdgilo
ttrsljgiratfmioajorh
gorljkihdnmnofnblfhm
bqjkaehetdjlgctmijpc
geslcskpoqjcgtbdspoa
riqthroqmmhqgprqhsba
fdiarrcomockfqdjjdkd
jsbnigfqgsfekbbnnkir
ildqctqtqrpcetaocp...

output:

9979
1 1 1
-1 1 1
-1 1 2
-1 1 3
-1 1 4
-1 1 5
-1 1 6
-1 1 7
-1 1 8
-1 1 9
-1 1 10
-1 1 11
-1 1 12
-1 1 13
-1 1 14
-1 1 15
-1 1 16
-1 1 17
-1 1 18
-1 1 19
-3 1 20
-3 2 20
-3 3 20
-3 4 20
-3 5 20
-3 6 20
-3 7 20
-3 8 20
-3 9 20
-3 10 20
-3 11 20
-3 12 20
-3 13 20
-3 14 20
-3 15 20
-3 16 20
-3 17 20
-3...

result:

ok puzzle solved

Test #9:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

20 20 2
HbevPluVL5ORtUFcV9gf
Mrq6zdTPMPnwlN7Fpzx6
Nfp71dVuxTZp9Qet0Ca9
ugbaF34DquDdbUnk5x7V
fDFszn4PmvMpJ5BDWueJ
2YvFxKJgst8XbftPfy9T
F7Q4huk87Lrp1M7i08is
Q41E5AqLkkP3Q5qONXC2
MuM7iIzev3ZpxItvriQK
6OBdEC0sso5vdNQlrCSR
BJQtKjN6RmppsMGIYL81
yyKsWJSoKorGGblNle0r
RkKEQACh8f0bS5nPTtJH
fQgoc39vdsPAUmxlYYL...

output:

-1

result:

ok puzzle solved

Test #10:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

20 20 2
pqo3Mcpvo74RFSsJszsa
znrYm92Qr8fbqhbCTOgq
4KiMYr0kLAxPGNG15x7L
QHKmq6xaJ4PU4msuRAiv
UBfS6VUO87hRnMAjGXKX
zCgknw3FfhdifmVcT6FF
GH6ohIAzZuprlC3vMDVh
mHIJ9KlQvWxt6EgGbJkA
3SwJNhRSdEeF9BNtc9k2
mZmEuriH7Rc4ccMjqI0Y
cFfI8TC1iM4PkKziLOiN
15CUjuwudnrums3c3dsl
ekL52LiFEpzmU4vaGtuX
CfrnQtWb5zAN9oQS2fj...

output:

6624
-1 16 6
-1 16 7
-1 16 8
-1 16 9
-1 16 10
-1 16 11
-1 16 12
-1 16 13
-1 16 14
-1 16 15
-1 16 16
-1 16 17
-1 16 18
-1 16 19
-3 16 20
-3 17 20
-3 18 20
-3 19 20
-1 11 6
-1 11 7
-1 11 8
-1 11 9
-1 11 10
-1 11 11
-1 11 12
-1 11 13
-1 11 14
-1 11 15
-1 11 16
-1 11 17
-1 11 18
-1 11 19
-3 11 20
-3 12 ...

result:

ok puzzle solved

Test #11:

score: 0
Accepted
time: 1ms
memory: 3976kb

input:

20 20 2
7CDCA3gd4c8OE3Zs0VE1
vszVp5b7Vw7NnPisnZYJ
hgfA8K4aV11nlDcDasWj
hg7y388G2MOuTOpEGDBh
DDTjEdOJNQHu2pzbuigf
6kdVkqykU2dDjqjDKD2v
vmaF9cP326rpwhVIl0K6
KchHgQg3BK7Hqt9uLAX4
8klt7U0BZ2C8Ky7DQ5Jo
Ce71gbv3U9nG7pNiwO5T
SII4sonVJ3F34MELKUlD
mLfuG79wBvqb2BKKLoRf
GnBA95Uadz3lO2Dvuob1
NLqlqTyNPTp5sihp2tC...

output:

-1

result:

ok puzzle solved

Test #12:

score: 0
Accepted
time: 1ms
memory: 3692kb

input:

20 20 2
PcYcPItqOwm4yYbBIt9e
iBIDFlswIdU1gSXVvuf7
GB55VjrsjvtPiW1lI0xt
8wDgW4acuIsbjY7McQHg
cpYGIgQ5cI3Ctu4iAJj5
K1KDs608gqVk9EQM6gMF
mJVEd5nuZQnlqLZ5Q2Yc
lo5wptbLMN2J0j3ZENzE
BTQuhuUjyGD1ha8mimg5
i6ixmpshNJ7TyUNjHcKm
bS7CeGdF4L50ZcHyVi7O
0iJYFD57UR6LLANOw7w6
qjwguPgl3YE4wk57cx6f
X5rA3btz798F76GFTPx...

output:

-1

result:

ok puzzle solved

Test #13:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

20 20 2
31JzWNDIcu64mRA4bbXn
nFHHOpnj3X6pjlT9XjtS
t6kqM1qCdWZlHYvND5AZ
Q580jYLFa8htqsbzmNwu
AnogbQ49yYDbGR5uIcRJ
er06ukvBAFUZ9wspjFdO
t1FndB74Vapme74N9Fhm
TGsrhjfKJ7orOyec8PRa
oraPL0zEQhfHGdSkFuQJ
6RxaAFbZ8kOkvDQgA2yf
rTHnPaAHHluAjaC5Vf41
JGYre0sXkS6W4f5oOVch
7jDPnIDXyLX5ymXMpxo7
AGtFpLNXqPnsO8f4UC2...

output:

-1

result:

ok puzzle solved

Test #14:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

20 20 5
98XQ4BMDPs7KQbGLQM94
5gAZZoXVtAOhWkV7eVC4
lcJaFORqa6FRYQJuyP2m
pHUWWwwcE5TYjXRD1f32
DwPeneIR7ks5Dq9kOS93
VJ9XAtGqjKxz6ib93VdB
nWGU5rGN8eFWanUFUuz8
8oBdZb4d9bFzPkC6aVZ5
U78CXMM9XkU1qltE2EM4
nkzXLl0pINNatqozmpsu
GoiFmfcKy7lWUpigV87d
63xk0X2RqyPWwc3uSkT7
I4JbBl4DTchy7cFhx07y
KQ5NgDHEwoO2EYyfIkF...

output:

-1

result:

ok puzzle solved

Test #15:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

20 20 5
VnbxSwLhwt7GUidif4lW
0lIVUk241YBWXNVXIalc
uICMK6WkoB9tDO76DKV2
L8p8DG3IXFSxguONRieG
eutIQAuRQWOEqZc3ycFo
AjUGtn3X6vFViizsHwNj
bESe5O4i0QCUlaLSuVkT
MPaf6lZmcZf38WvUGLHD
bzTdwp4OJVayTmOGCvkv
znkkxaiEncYIADpGlrsB
mnLYGHXEZp1mErfJMeh0
vBi2nEG1SCLHclLTwrqW
agGGIwO0puMF52Jyk0SK
3a3IY7jkpwvjXSRMLy5...

output:

6607
-1 20 5
-1 20 4
-1 20 3
-1 20 2
-3 16 10
-3 17 10
-3 18 10
-3 19 10
-1 20 9
-1 20 8
-1 20 7
-1 20 6
-1 20 5
-1 20 4
-1 20 3
-1 20 2
-1 20 1
-3 13 15
-3 14 15
-3 15 15
-3 16 15
-3 17 15
-3 18 15
-1 19 14
-1 19 13
-1 19 12
-1 19 11
-1 19 10
-1 19 9
-1 19 8
-1 19 7
-1 19 6
-1 19 5
-1 19 4
-1 19 3
...

result:

ok puzzle solved

Test #16:

score: 0
Accepted
time: 4ms
memory: 3692kb

input:

20 20 5
zzh9PnCVcvoyTl0XNqBR
NhRWLcbdGlpC2hYU4p7z
Q9zsPBWaybIU9LzvEJOv
cGYogJA6gn379WLXDlps
UE28n4kYuBi60G3VpJ3y
fXFdrdzuLkCclp1Qucaa
cb8vXeoIVEISF1z63mXI
akRc9rUDqJThkHgM3Glf
o0MX2ThxnjB0vjgUgzOR
PD5PmQv52G9lu5pEvwoI
2nah8lAHqPGAwxocL8kQ
Ug6vDhj7gtLnPHtrhCKQ
xjAbQPvwYHhE71R580zS
iHeGypUWdQkxoUmnLPA...

output:

5948
-1 14 14
-1 14 15
-1 14 16
-1 14 17
-1 14 18
-1 14 19
-3 14 20
-3 15 20
-3 16 20
-3 17 20
-3 18 20
-3 19 20
-1 14 7
-1 14 8
-1 14 9
-1 14 10
-1 14 11
-1 14 12
-1 14 13
-1 14 14
-1 14 15
-1 14 16
-1 14 17
-3 14 18
-3 15 18
-3 16 18
-3 17 18
-3 18 18
-3 19 18
-1 12 1
-1 12 2
-1 12 3
-1 12 4
-1 12...

result:

ok puzzle solved

Test #17:

score: 0
Accepted
time: 8ms
memory: 3692kb

input:

20 20 5
cz7yfUxuJVlDaZw6BPsE
anVcSZ5DDJPMPJjAEljh
mWcTQaRUJ21VBsk9LtMn
IU2kOtF8GrxsO4Ap77yc
aGzhzRS8gjFAsFNP8nAm
5G1OJUh0WhP43mJzhSj1
o55Q582zXKwA7idbCXyI
LvXe3CGvyW2YRTsE7KZ2
8yPYtMObYNoli6LvAYcn
TEba0LujH9bXK0S4q7pd
htdrztum0MdvYWaNJ2EJ
gX6XBJOPOFMIbtxHaVQX
cuaLLQVLomjYM1XQhfrx
v1zIJ7H4lHpG9W1xbxE...

output:

6095
-1 17 9
-1 17 10
-1 17 11
-1 17 12
-1 17 13
-1 17 14
-1 17 15
-1 17 16
-1 17 17
-1 17 18
-1 17 19
-3 17 20
-3 18 20
-3 19 20
-1 14 12
-1 14 13
-1 14 14
-1 14 15
-1 14 16
-1 14 17
-1 14 18
-3 14 19
-3 15 19
-3 16 19
-3 17 19
-3 18 19
-3 19 19
-1 8 7
-1 8 8
-1 8 9
-1 8 10
-1 8 11
-1 8 12
-1 8 13
...

result:

ok puzzle solved

Test #18:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

20 20 5
us00j7HM7PdH2WRz3xcM
ejN853WC2u56Ob8OhaFY
dvfiTNQ0vxAvSuOCKuPH
hxt33vcCeNyWRCHbl8nC
zI3R2j64CEb8N6O1oU41
qYchY8MtgwTJZil7DlS7
vmKw9IE8U8yFVsqUVAVW
7No9WxCuw4oKt4yMFLhu
335m5dxtgl4WH5qpS3M5
DAfNe1hS6J0lDJS5j5pa
BxSda2Jrvmy5aZdkS8FW
JiifhY3xqGMTvgPhsKr8
Kn8gzxeoP5OVO2PwxfKh
cuxJdH5sFnExQUAW7ge...

output:

-1

result:

ok puzzle solved

Test #19:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

20 20 5
MgIgubIcCNXH2Mg2w40R
rnEfibRlq6ivJHdMNUTN
OZmyNvIahT20lAm0Fz05
YaZNuoFaRdmjYaD1v54P
YDunv1c9XVGDchTdxoCN
Losy0epOtHOoVbXGQFmo
HMyg9ttIYpsHCFyGl967
BiI4SrDdttKfejRY5ZD0
RBgzAJgGyKHyd86fjciJ
rluiohbDngPEIoR3d0o3
SykYMoYx80TRiT8JX5ve
sGBNQlprQCJ5L38RLL7e
nnbPomySkRfOIbD3KnZW
XayKrhqQI7TfB0ap3YR...

output:

-1

result:

ok puzzle solved

Test #20:

score: 0
Accepted
time: 3ms
memory: 3784kb

input:

20 20 10
vZ2BGfzD3YncgS0RvCYc
ba3pLJQUNwJnbJPnsT9Y
JzqswEDnMTmMARVImvv9
UqOL3CmC3yEF5WaFyIDn
mMRvEEoTtfiesDNw6I0b
zSUGmC5DonGeLWy9DBpd
gBySN2vXSsZB3pdM5i4r
yVjGsVyaJmDB9LjZ6gsY
dwIQcEYAQzPReN7lWflz
dFs27yv6ytvVPGRE4Qk7
Z6AGE5mRpdLvsq9fb5L9
hvrn14Ey3zzX9GNVcNzx
eLXaglbY8GMMVJ2r4KZ8
Y3POq7ystreSt2k9ZH...

output:

7510
-1 14 15
-1 14 16
-1 14 17
-1 14 18
-1 14 19
-3 14 20
-3 15 20
-3 16 20
-3 17 20
-3 18 20
-3 19 20
-3 10 19
-3 11 19
-3 12 19
-3 13 19
-3 14 19
-3 15 19
-3 16 19
-3 17 19
-3 18 19
-3 19 19
-1 7 11
-1 7 12
-1 7 13
-1 7 14
-1 7 15
-1 7 16
-1 7 17
-1 7 18
-1 7 19
-3 7 20
-3 8 20
-3 9 20
-3 10 20
-...

result:

ok puzzle solved

Test #21:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

20 20 10
938hu3udF0D8o3Bo7Ua3
Za7iCB6ZlUAbgdS9O8R5
X4n3C1HhWsU8fPn7nqsD
l3j1GFP9mkLjQx2OkLO9
9GvVb4aWbQMJ7gMgXfAx
esFhkws6c8HzX30AhdY0
9cCcNgLrJ3Xzfc54EFSc
0rWLz5tnY2dTls0VG2as
qYsEH5bjy25oPKzvs6PR
pUppXiBolKGyO5SGeSke
x23UaFbMQDqNkk6Q6bV4
KbkQpOiDszDPP1ulUVTv
JXUBrEVmHQkT1LaMOGOp
lAON0BmcpD76I4LK3Y...

output:

6069
-1 16 7
-1 16 8
-1 16 9
-1 16 10
-1 16 11
-1 16 12
-1 16 13
-1 16 14
-3 16 15
-3 17 15
-3 18 15
-3 19 15
-3 13 8
-3 14 8
-3 15 8
-3 16 8
-3 17 8
-3 18 8
-3 19 8
-1 20 7
-1 20 6
-1 20 5
-1 20 4
-1 13 1
-1 13 2
-1 13 3
-1 13 4
-1 13 5
-1 13 6
-1 13 7
-1 13 8
-1 13 9
-1 13 10
-1 13 11
-1 13 12
-1 ...

result:

ok puzzle solved

Test #22:

score: 0
Accepted
time: 4ms
memory: 3720kb

input:

20 20 10
VnqQrUtVm6Qcv2kVwjqZ
Me8fpxb40dwNdKWbijAs
eocFHrEba2kKMMPFslhj
LqSeiPuBNUSXN3VY9GZV
LH5lIu5WPvgbHXL4HEYL
TYySliQHRXLQ16sX4KqQ
1QSsFG1NNJ3xyVTld1v1
AWDEH2oxXMUgFdTF4SO0
GqdjdHtXczsErLUy9Yid
FX6UJZOH0aRaJiOElXkh
cXtdybWOhU590pbiTeYM
5I4qErVRUCDzob8Lt2qk
3WS6DPBSk8PWZGeitCzB
E6RHI11O5XOoXY7g7c...

output:

5928
-1 3 2
-1 3 3
-1 3 4
-1 3 5
-1 3 6
-1 3 7
-1 3 8
-1 3 9
-1 3 10
-1 3 11
-3 3 12
-3 4 12
-3 5 12
-3 6 12
-3 7 12
-3 8 12
-3 9 12
-3 10 12
-3 11 12
-3 12 12
-3 13 12
-3 14 12
-3 15 12
-3 16 12
-3 17 12
-3 18 12
-3 19 12
7 1 1
-3 16 17
-3 17 17
-3 18 17
-3 19 17
-3 13 14
-3 14 14
-3 15 14
-3 16 14...

result:

ok puzzle solved

Test #23:

score: 0
Accepted
time: 4ms
memory: 3720kb

input:

20 20 10
4TqYTxl8WMfOTwo9y96N
pASI3kKQD1AYSQHBNlgN
Cc3It3amJn5ATGFgE4F4
vdJaj4lyfRy31A8bPQWb
RaXyFlN944KyDL7NLpPK
5GBn13FiPtmwtw5NQHEK
4SHyvGNzvibxwQtbX9WU
IViOzT3EkViVWD29MMqA
dVZaneabLenTL0gsYzen
bjnt74OXhZ2ny32ucDWs
67VjWOdogE9GqrP29HS6
SUJkX1NCnQ43ZnbbTwYe
nDYckGZKm1IGaroiqt0Z
TQ4UoKH6P1JhQwpc1b...

output:

6561
-1 18 1
-1 18 2
-1 18 3
-1 18 4
-1 18 5
-1 18 6
-1 18 7
-1 18 8
-1 18 9
-1 18 10
-1 18 11
-1 18 12
-1 18 13
-1 18 14
-1 18 15
-3 18 16
-3 19 16
-3 11 18
-3 12 18
-3 13 18
-3 14 18
-3 15 18
-3 16 18
-3 17 18
-3 18 18
-3 19 18
-1 20 17
-1 11 5
-1 11 6
-1 11 7
-1 11 8
-1 11 9
-1 11 10
-3 11 11
-3 ...

result:

ok puzzle solved

Test #24:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

20 20 10
jIjlXJvqkKeNHqJu9OU0
CEJLgoBLXEMfViAPn2xu
oH67vH5wzVx9iEhJz5Ms
cQaYCUK6Whnp87f1VRDx
g1n8g3TaitgQY883TWro
q6QI3ddTaMpbtlDqb5d2
7ariwbB5zGdzc4F1oMj4
4lFRwN0rmbEzDSdpoWM2
XmeqRF1p7Q8v9VOhgAG1
Zcy2pkEFCzJPzM1o5x0l
qbs5qistTeukyuKA6NLk
tmYSzo9xVR4ejixLclAl
0rWL8vnnJF5z8wgXCxfJ
wk1VCs2uXTUZxu6F2U...

output:

-1

result:

ok puzzle solved

Test #25:

score: 0
Accepted
time: 3ms
memory: 3692kb

input:

20 20 10
FA9N0SwQDIYNzj8XBsE1
OANStwtCpgQDMOxRWQTj
3jdrqk1GuefBDSP7uaTY
DdNI0RcvvDgQftmO9SoL
A7OINHbaDNMpjrdn2yRa
Uw67anQem6lUtmbYpqMb
fze2EPhJI57BTdNOPlyj
yMYLpL5h7v4dr7ftS94u
GYuGq6NOqfKay6tfyIkB
B0OFDAnmXez8Jv1pZwZe
HcZQ2NPrsOK2SoNZbHIC
8L5mkLwjtJ4yG1Qmyifr
Gs7g5cuRaAws2y9qTxxt
dOVW2YnWcz1MiwF4YG...

output:

7114
-1 20 12
-1 20 13
-1 20 14
-1 20 15
-1 20 16
-1 20 17
-1 20 18
-1 20 19
-1 19 3
-1 19 4
-1 19 5
-1 19 6
-1 19 7
-1 19 8
-1 19 9
-1 19 10
-1 19 11
-1 19 12
-1 19 13
-1 19 14
-1 19 15
-1 19 16
-3 19 17
-1 18 2
-1 18 3
-1 18 4
-1 18 5
-1 18 6
-1 18 7
-1 18 8
-3 18 9
-3 19 9
-3 15 18
-3 16 18
-3 17...

result:

ok puzzle solved

Test #26:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

20 20 20
fLlNCdZX1Un4dhtk9m7p
756yPELepI3iEGVX8bMy
eCKueEJd9lS3ytjuny1I
pZC8W9Qbtz0Uv0WLzxNL
scr2iRpfNLMzPI3FDkQA
Z3jFw6yQAnpaMufv1eHh
ylh0rE1Tgq1pgCWdEBiZ
3ieCmZhc7NdmoWjBgyQI
PMasLnbSgcjghs5PTPZn
XU9gnl5jgeS1vGTy2Qhz
0Hid9loq3tpDmhys562S
JOZWgqra0vPkS2nh1lFi
iOsZXAFhU8FS5BDD83QY
A5Re5s0LdCXzrJN9Lc...

output:

-1

result:

ok puzzle solved

Test #27:

score: 0
Accepted
time: 0ms
memory: 4012kb

input:

20 20 20
XXAlDcMBIVz0lo4YDEmg
392vKwPjX6Z2JdZNDqyW
z7H6j4N7n2qFdjP2otQk
Yublz8jIM9bmosPVhA2u
461oPdbesqg5uhUwvNeS
ED4oy0VrnbuvQFDSGH87
q4mgj4ln8aZnshOrh23K
vOVEq1cdapRAEHcpEkuc
2dR89VxB2IGMOppOAHxF
d9YD51iJVz3vB1Qw9Rdu
JCHsxQhxqX43efDU491x
4qJwEbcbszP9Ck5DIA47
CZpy8UpNth9R3IPYWVC2
LBT5FSGf5WQRGDeKLq...

output:

6398
-1 10 3
-1 10 4
-1 10 5
-1 10 6
-1 10 7
-1 10 8
-1 10 9
-1 10 10
-1 10 11
-1 10 12
-1 10 13
-1 10 14
-1 10 15
-1 10 16
-1 10 17
-1 10 18
-1 10 19
-3 10 20
-3 11 20
-3 12 20
-3 13 20
-3 14 20
-3 15 20
-3 16 20
-3 17 20
-3 18 20
-3 19 20
-1 6 13
-1 6 14
-1 6 15
-1 6 16
-1 6 17
-3 6 18
-3 7 18
-3 ...

result:

ok puzzle solved

Test #28:

score: 0
Accepted
time: 4ms
memory: 3784kb

input:

20 20 20
FcKTzZPjkXP1xvNve3Cb
Q6boxsYwHlJERH2H3Jh7
MzAHorKXxtM1WhhEtwBO
gRCBoaYadJj4l6L46vl8
R4sOaE5ha5Gw8YPcegK6
jdPVnMj23WqU2E1bwfwY
rECAjmES3L5mL7FEQpGv
XjuFx7bq9cq4Qk9hdecO
iBBOEyGbJb03qmGQiyW1
p8J4RLz2AZicwdQyf1lB
hueHVm2rSfJh3kInVfgr
pXqY1OQhUyXPjtI3uAo1
Z3nZk5ei3DE29yXvxUni
8WS3jmhVTcF1ZFwhPH...

output:

6688
-1 16 5
-1 16 6
-1 16 7
-1 16 8
-1 16 9
-1 16 10
-1 16 11
-1 16 12
-1 16 13
-1 16 14
-1 16 15
-1 16 16
-1 16 17
-1 16 18
-3 16 19
-3 17 19
-3 18 19
-3 19 19
-1 14 3
-1 14 4
-1 14 5
-1 14 6
-1 14 7
-1 14 8
-1 14 9
-1 14 10
-1 14 11
-1 14 12
-1 14 13
-1 14 14
-1 14 15
-1 14 16
-1 14 17
-1 14 18
-...

result:

ok puzzle solved

Test #29:

score: -100
Wrong Answer
time: 0ms
memory: 3712kb

input:

20 20 20
6SCG0JDRlzxfS8EHKcMD
ZkYT7WwrzFLNpJ6CUVTm
ywphmYrRdHg9CynoJn2r
IOqTMa5Yqi1M1qEbJSXz
xKCN1YrJe50J31Lt75z2
dy4YpYHDlliwcZ7HKe3o
H4H9eKrj19GUHQYA8vv1
p8wdnsRdZDRVJVmEahsW
0ldLFHPEzDkRzieYBUIn
jYfsKZcLqzOw7B59pPWJ
ZiCA7APSWfjrn1F3raNE
Mh4mhvS8tI8LY37mnNv9
GW98dE5HrI91USvPe0bP
sm7d8z6i3GxRmTqoR6...

output:

not continue
17 2 ----> 59 = tar
W 6
6 7
( 0, 2) 6 ( 1, 5) 6 ( 2, 3) 6 ( 9, 0) 6 ( 13, 3) 6 ( 13, 4) 6 ( 15, 2) 6 
ERROR in fix
step 1 :: 17 2 W 6
19 19 7
6518
-1 20 18
-1 20 19
-1 3 11
-1 3 12
-1 3 13
-1 3 14
-1 3 15
-1 3 16
-1 3 17
-1 3 18
-3 3 19
-3 4 19
-3 5 19
-3 6 19
-3 7 19
-3 8 19
-3 9 19
-3...

result:

wrong output format Expected integer, but "not" found