QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#117856 | #6684. Trie | tute7627 | AC ✓ | 75ms | 45300kb | C++17 | 10.4kb | 2023-07-02 11:36:12 | 2023-07-02 11:36:14 |
Judging History
answer
//#define _GLIBCXX_DEBUG
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include <debug_print.hpp>
#define OUT(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define OUT(...) (static_cast<void>(0))
#endif
#define endl '\n'
#define lfs cout<<fixed<<setprecision(15)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using QP = priority_queue<T,vector<T>,greater<T>>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}
template<typename T1,typename T2,typename T3>void anss(T1 x,T2 y,T3 z){ans(x!=y,x,z);};
template<typename T>void debug(const T &v,ll h,ll w,string sv=" "){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout<<sv<<v[i][j];cout<<endl;}};
template<typename T>void debug(const T &v,ll n,string sv=" "){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout<<sv<<v[i];cout<<endl;};
template<typename T>void debug(const vector<T>&v){debug(v,v.size());}
template<typename T>void debug(const vector<vector<T>>&v){for(auto &vv:v)debug(vv,vv.size());}
template<typename T>void debug(stack<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(queue<T> st){while(!st.empty()){cout<<st.front()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(deque<T> st){while(!st.empty()){cout<<st.front()<<" ";st.pop_front();}cout<<endl;}
template<typename T>void debug(PQ<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(QP<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(const set<T>&v){for(auto z:v)cout<<z<<" ";cout<<endl;}
template<typename T>void debug(const multiset<T>&v){for(auto z:v)cout<<z<<" ";cout<<endl;}
template<typename T,size_t size>void debug(const array<T, size> &a){for(auto z:a)cout<<z<<" ";cout<<endl;}
template<typename T,typename V>void debug(const map<T,V>&v){for(auto z:v)cout<<"["<<z.first<<"]="<<z.second<<",";cout<<endl;}
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << "(" << p.first << "," << p.second << ")";}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){os<<"[";for(auto &z:v)os << z << ",";os<<"]"; return os;}
template<typename T>void rearrange(vector<int>&ord, vector<T>&v){
auto tmp = v;
for(int i=0;i<tmp.size();i++)v[i] = tmp[ord[i]];
}
template<typename Head, typename... Tail>void rearrange(vector<int>&ord,Head&& head, Tail&&... tail){
rearrange(ord, head);
rearrange(ord, tail...);
}
template<typename T> vector<int> ascend(const vector<T>&v){
vector<int>ord(v.size());iota(ord.begin(),ord.end(),0);
sort(ord.begin(),ord.end(),[&](int i,int j){return make_pair(v[i],i)<make_pair(v[j],j);});
return ord;
}
template<typename T> vector<int> descend(const vector<T>&v){
vector<int>ord(v.size());iota(ord.begin(),ord.end(),0);
sort(ord.begin(),ord.end(),[&](int i,int j){return make_pair(v[i],-i)>make_pair(v[j],-j);});
return ord;
}
template<typename T> vector<T> inv_perm(const vector<T>&ord){
vector<T>inv(ord.size());
for(int i=0;i<ord.size();i++)inv[ord[i]] = i;
return inv;
}
ll FLOOR(ll n,ll div){assert(div>0);return n>=0?n/div:(n-div+1)/div;}
ll CEIL(ll n,ll div){assert(div>0);return n>=0?(n+div-1)/div:n/div;}
ll digitsum(ll n){ll ret=0;while(n){ret+=n%10;n/=10;}return ret;}
ll modulo(ll n,ll d){return (n%d+d)%d;};
template<typename T>T min(const vector<T>&v){return *min_element(v.begin(),v.end());}
template<typename T>T max(const vector<T>&v){return *max_element(v.begin(),v.end());}
template<typename T>T acc(const vector<T>&v){return accumulate(v.begin(),v.end(),T(0));};
template<typename T>T reverse(const T &v){return T(v.rbegin(),v.rend());};
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int popcount(ll x){return __builtin_popcountll(x);};
int poplow(ll x){return __builtin_ctzll(x);};
int pophigh(ll x){return 63 - __builtin_clzll(x);};
template<typename T>T poll(queue<T> &q){auto ret=q.front();q.pop();return ret;};
template<typename T>T poll(priority_queue<T> &q){auto ret=q.top();q.pop();return ret;};
template<typename T>T poll(QP<T> &q){auto ret=q.top();q.pop();return ret;};
template<typename T>T poll(stack<T> &s){auto ret=s.top();s.pop();return ret;};
ll MULT(ll x,ll y){if(LLONG_MAX/x<=y)return LLONG_MAX;return x*y;}
ll POW2(ll x, ll k){ll ret=1,mul=x;while(k){if(mul==LLONG_MAX)return LLONG_MAX;if(k&1)ret=MULT(ret,mul);mul=MULT(mul,mul);k>>=1;}return ret;}
ll POW(ll x, ll k){ll ret=1;for(int i=0;i<k;i++){if(LLONG_MAX/x<=ret)return LLONG_MAX;ret*=x;}return ret;}
namespace converter{
int dict[500];
const string lower="abcdefghijklmnopqrstuvwxyz";
const string upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string digit="0123456789";
const string digit1="123456789";
void regi_str(const string &t){
for(int i=0;i<t.size();i++){
dict[t[i]]=i;
}
}
void regi_int(const string &t){
for(int i=0;i<t.size();i++){
dict[i]=t[i];
}
}
vector<int>to_int(const string &s,const string &t){
regi_str(t);
vector<int>ret(s.size());
for(int i=0;i<s.size();i++){
ret[i]=dict[s[i]];
}
return ret;
}
vector<int>to_int(const string &s){
auto t=s;
sort(t.begin(),t.end());
t.erase(unique(t.begin(),t.end()),t.end());
return to_int(s,t);
}
vector<vector<int>>to_int(const vector<string>&s,const string &t){
regi_str(t);
vector<vector<int>>ret(s.size(),vector<int>(s[0].size()));
for(int i=0;i<s.size();i++){
for(int j=0;j<s[0].size();j++){
ret[i][j]=dict[s[i][j]];
}
}
return ret;
}
vector<vector<int>>to_int(const vector<string>&s){
string t;
for(int i=0;i<s.size();i++){
t+=s[i];
}
sort(t.begin(),t.end());t.erase(unique(t.begin(),t.end()),t.end());
return to_int(s,t);
}
string to_str(const vector<int>&s,const string &t){
regi_int(t);
string ret;
for(auto z:s)ret+=dict[z];
return ret;
}
vector<string> to_str(const vector<vector<int>>&s,const string &t){
regi_int(t);
vector<string>ret(s.size());
for(int i=0;i<s.size();i++){
for(auto z:s[i])ret[i]+=dict[z];
}
return ret;
}
}
template< typename T = int >
struct edge {
int to;
T cost;
int id;
edge():to(-1),id(-1){};
edge(int to, T cost = 1, int id = -1):to(to), cost(cost), id(id){}
operator int() const { return to; }
};
template<typename T>
using Graph = vector<vector<edge<T>>>;
template<typename T>
Graph<T>revgraph(const Graph<T> &g){
Graph<T>ret(g.size());
for(int i=0;i<g.size();i++){
for(auto e:g[i]){
int to = e.to;
e.to = i;
ret[to].push_back(e);
}
}
return ret;
}
template<typename T>
Graph<T> readGraph(int n,int m,int indexed=1,bool directed=false,bool weighted=false){
Graph<T> ret(n);
for(int es = 0; es < m; es++){
int u,v;
T w=1;
cin>>u>>v;u-=indexed,v-=indexed;
if(weighted)cin>>w;
ret[u].emplace_back(v,w,es);
if(!directed)ret[v].emplace_back(u,w,es);
}
return ret;
}
template<typename T>
Graph<T> readParent(int n,int indexed=1,bool directed=true){
Graph<T>ret(n);
for(int i=1;i<n;i++){
int p;cin>>p;
p-=indexed;
ret[p].emplace_back(i);
if(!directed)ret[i].emplace_back(p);
}
return ret;
}
void solve(){
int n,m;cin>>n>>m;
Graph<char>g(n+1);
vector<int>dep(n+1);
rep(i,1,n+1){
int a;cin>>a;
g[a].EB(i);
dep[i]=dep[a]+1;
}
vector<bool>sp(n+1);
rep(i,0,m){
int k;cin>>k;
sp[k]=true;
}
vector<int>nxt(n+1);
string s(n,'-');
auto dfs=[&](auto &&f,int k)->list<int> {
vector<list<int>>ver;
for(auto to:g[k]){
ver.push_back(move(f(f,to)));
}
list<int>ret;
ret.push_back(k);
vector<int>ord(ver.size());
iota(ALL(ord),0);
//OUT(ver);
stable_sort(ALL(ord),[&](int i,int j)->bool {
if(i==j)return false;
auto it=ver[i].begin();
auto jt=ver[j].begin();
//OUT(i,j,ver[i].size(),ver[j].size());
while(it!=ver[i].end()&&jt!=ver[j].end()){
//if(k==1&&i==1&&j==0){
//OUT(*it,*jt,dep[*it],dep[*jt],sp[*it],sp[*jt]);
//}
if(dep[*it]!=dep[*jt]){
return dep[*it]>dep[*jt];
}
if(sp[*it]!=sp[*jt]){
return sp[*it];
}
it=next(it);
jt=next(jt);
}
return it!=ver[i].end();
});
char e='a';
for(auto i:ord){
s[g[k][i].to-1]=e++;
ret.splice(ret.end(),move(ver[i]));
}
//OUT(ret);
return move(ret);
};
dfs(dfs,0);
cout<<s<<endl;
}
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll res=0,buf=0;
bool judge = true;
int T;cin>>T;
while(T--){
solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3420kb
input:
2 5 4 0 1 1 2 2 1 4 3 5 1 1 0 1
output:
abaab a
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
400 3 3 0 1 2 1 2 3 2 2 0 1 2 1 5 3 0 0 0 3 1 4 2 5 4 4 0 1 0 3 3 4 1 2 1 1 0 1 2 1 0 1 2 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 8 4 0 0 2 3 2 5 1 5 7 6 8 4 5 3 0 1 2 1 3 5 4 1 1 1 0 1 2 2 0 1 2 1 2 1 0 1 2 1 1 0 1 3 3 0 1 2 3 2 1 3 3 0 1 1 2 3 1 2 1 0 1 2 1 1 0 1 2 2 0 1 2 1 1 1 0 1 2 1 0 1 2 1 1 ...
output:
aaa aa bacaa aaba a aa a a a a a abbaaaab abaaa a aa aa a aaa aab aa a aa a aa a abca ab aa aa a ab a aa a aaab a a abaaacba aaaa a a ab baaab aa a aa baaab aa ab a a abc a a abbaaaa aaa baaa a aa aaaa aa aaaab bcaab aaa aabaaaa aaa baaaaa baaaa aa a aab aa a abaa a baa aab aa baaa aba a abaa aa a a...
result:
ok 400 lines
Test #3:
score: 0
Accepted
time: 52ms
memory: 3472kb
input:
50000 3 2 0 0 1 3 2 4 4 0 1 1 2 3 4 2 1 7 5 0 1 2 2 3 4 2 7 6 4 1 5 4 4 0 1 1 1 3 4 2 1 4 4 0 1 2 3 4 3 1 2 2 1 0 1 2 2 2 0 0 2 1 3 3 0 0 1 2 3 1 3 3 0 1 2 3 1 2 4 3 0 1 0 3 2 1 4 5 2 0 0 2 3 4 1 5 1 1 0 1 18 11 0 0 1 3 4 3 3 3 7 9 5 11 11 10 2 11 11 15 9 12 13 10 6 17 14 8 16 15 18 1 1 0 1 18 14 0 ...
output:
baa aaba aacaaab aabc aaaa aa ab aba aaa aaba abaaa a baadaacbaaaabaacda a bacabaaacaabaaabaa aaab aaa aabaaa aa baaaa aab a aaaabbaaaaa aaabb baaa aab a abababaaa a aba aab aababaaa caabaabcabaa a aaa aaaba a ab aa aaacbbbaabaabaaaaaabaaa a aa aaaa ab a ab baa baa a aaabac aa aa baaab abaaa aa abac...
result:
ok 50000 lines
Test #4:
score: 0
Accepted
time: 51ms
memory: 3520kb
input:
50000 1 1 0 1 11 8 0 0 0 0 1 3 2 3 0 7 2 5 8 9 6 11 10 4 2 4 4 0 0 0 1 3 4 2 1 6 4 0 0 2 0 3 0 5 4 1 6 6 5 0 0 1 1 0 0 2 4 3 6 5 2 2 0 0 1 2 6 6 0 0 0 1 1 0 3 4 6 2 1 5 1 1 0 1 1 1 0 1 3 3 0 0 0 1 3 2 8 8 0 1 1 2 1 0 3 2 3 5 1 8 7 4 6 2 1 1 0 1 2 2 0 1 2 1 2 2 0 1 1 2 1 1 0 1 4 4 0 0 0 0 1 4 3 2 2 2...
output:
a eadbaabbcaa abca adabac daabbc ab abcabd a a abc aabacbab a aa aa a abcd ab aba ab ab ab baacd a abcabd abc a a ab aba abc a abc a aabbcda ab a abcda ab aa afbabcade a a ab cdaaba dababca aa ab a a abac ab ab abac abc aa ab baab abaa abc baaa bcdaedafbaaaaca aedaaaabcb a abaaa ab baabca a a abc ba...
result:
ok 50000 lines
Test #5:
score: 0
Accepted
time: 50ms
memory: 3480kb
input:
50000 3 3 0 1 2 1 3 2 2 2 0 1 2 1 1 1 0 1 12 2 0 1 2 3 4 5 6 7 8 8 10 11 12 9 3 2 0 1 2 3 1 4 2 0 1 2 3 4 3 5 5 0 1 2 3 4 4 2 3 1 5 2 1 0 1 2 6 4 0 1 2 3 4 5 4 3 2 6 7 5 0 1 2 3 4 4 6 7 3 2 4 5 2 1 0 1 2 4 2 0 1 2 3 3 4 6 4 0 1 2 2 4 5 1 3 6 2 2 2 0 1 1 2 4 1 0 1 2 3 4 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 ...
output:
aaa aa a aaaaaaaaabaa aaa aaaa aaaaa aa aaaaaa aaaaaba aa aaaa aaabaa aa aaaa a a a a a aaaa aaaa aaaa aaaaaaba aaaaaaabaaa aaaaaabaaabab aaaaaaaaa aaaaaaaaa aa aaaaaa aaaaaaabba a a a aaaaaa aaaaaa aa aa aaa aaabaaab aaaaaaaaa aa aaaaa a aaa a aaaa aa aa a aa aa a a aaa a a aaaaaaabaabaaab a a aaaa...
result:
ok 50000 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
3 288 171 0 1 0 1 3 2 3 6 4 8 4 11 8 5 12 9 11 14 9 11 17 17 13 11 5 25 25 23 28 16 6 19 29 11 27 8 32 33 15 17 34 2 33 19 34 24 29 18 38 35 43 43 34 45 26 23 20 57 44 51 45 22 51 63 52 61 27 41 57 44 70 71 54 10 56 72 46 44 72 12 56 76 66 45 19 74 46 68 74 44 57 62 47 76 50 89 21 45 23 96 70 80 63 ...
output:
baabaabbabbdcbbbabaecaacabacbaaccbbaacabcbbabababbbadaabaaccbabbaaabcaacabbbbdaacaadbcaabebaabbaacaabaaaacaaaaaaaaaaacadbaaabbaaaaabbcaaaabaaaabbbbaabbaaaabbababaabbaaabaaaababaaaaabaabaaaaacbaabaaaaabaaabaaaabbabbabacbabaabcaacaaaaabdbbaaaaaabaacaaaabaaaabaababbaaaacaaaaababaaabaaaaabaa adbbacbabab...
result:
ok 3 lines
Test #7:
score: 0
Accepted
time: 68ms
memory: 18372kb
input:
4 3728 3156 0 0 2 2 4 2 5 4 8 4 5 8 9 10 12 6 13 14 18 17 17 20 12 15 21 23 12 24 2 22 21 11 28 28 34 1 12 33 13 38 24 39 8 14 40 45 17 42 30 44 46 39 19 30 49 11 51 57 21 26 32 55 48 41 9 61 52 37 39 53 55 8 22 42 55 73 67 24 60 53 68 58 78 40 46 40 41 62 66 69 70 69 92 45 62 87 84 81 35 89 100 32 ...
output:
baadbbbabcaabbbaaaaacacbbadacaaabaaaabbabbcbcabbcacaaaabaacabbbbacaacaadbccabcabaaabaaaaacadadcbbabaaababaabbbbacbbaaaaababbcadbbbaaabaaacbcabbcaabadcabaabdaaaccaabeababbaaeaaaaaabaccacaababababadaadabaaaaaaadabdcacacaaaabbaeababaabaaaababbbcaaabbacbaebabcbaccadbaaabaababaaabedcaaacaaabbebcccbbbabaa...
result:
ok 4 lines
Test #8:
score: 0
Accepted
time: 58ms
memory: 9032kb
input:
5 25004 22919 0 0 2 0 1 2 4 0 1 2 7 0 5 1 7 7 3 6 11 6 12 1 6 1 7 2 16 6 4 25 21 10 7 8 5 25 10 5 8 14 4 19 6 31 1 6 8 12 14 21 31 21 14 38 4 27 2 23 46 12 26 31 51 4 21 0 30 3 53 26 12 9 65 1 9 18 22 23 28 2 12 5 40 50 21 34 5 41 56 33 7 8 68 48 9 11 54 29 43 28 15 73 35 55 76 37 24 92 44 22 74 52 ...
output:
cbbjqqqddcaalaclaalgaccbbakdbaabdbalakcjdatbebackcapanaadaabaoacbkifbbdaarcaabbfocbffbbeaamojadaafadaabaaamaabihcclcfddfjbeagfafaaoejbfcdkacbbdcdpidbaaeaadceaabnbafcadchebcngbjefabeaablbnbmachabaaaeafcaaadfbnmbjcabmdbcblbabdeaaaaaaabfbfcbacbaaaacadhldaddhjadbgqraccabbfcbbcefcbbbblaclgcagabaacnbbeqic...
result:
ok 5 lines
Test #9:
score: 0
Accepted
time: 52ms
memory: 12336kb
input:
6 26746 14833 0 1 2 3 4 5 6 7 8 9 9 11 12 11 14 14 16 15 14 18 20 19 20 21 24 25 26 25 28 28 30 31 32 32 34 33 36 37 35 38 36 39 36 41 43 45 45 43 38 42 49 50 47 51 54 53 54 56 48 59 51 51 55 57 56 59 58 65 56 61 56 60 72 69 65 69 76 64 54 77 78 77 80 80 84 85 85 86 85 87 82 87 81 92 94 87 89 76 90 ...
output:
aaaaaaaaaabbaaabaacabaaaabaaabaabaaaaaaacabaababbaaaabbacdabcaaacaaaaabaaabbaaabaadbaabacdaaaaababacaaaaaaacabdbababbaabaaaabbabbaababbaccababaaaabcbcbaaababbbcaaaaaaabbaaaaaacbbaabaaaaacaabaaaaabababaabaaaaababaaacacacaaaabaaaaaaaacadabbbbaabaaacbaababaaaacaaabaaabbbaabaaababababbabdaaaaabbdcbbaaab...
result:
ok 6 lines
Test #10:
score: 0
Accepted
time: 50ms
memory: 8940kb
input:
5 71039 60992 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 1 0 0 2 0 1 6 1 0 0 1 3 5 1 1 0 0 0 0 2 2 0 4 7 1 2 37 10 33 3 1 1 2 2 10 1 7 3 1 2 50 5 16 8 9 10 8 3 17 17 10 1 9 8 8 18 5 19 15 13 16 1 2 10 2 7 6 6 73 87 5 76 69 80 1 2 3 2 3 5 2 1 16 7 100 1 9 4 17 22 11 5 8 45 1 12 16 23 7 17 4 6 110 2 2 5 ...
output:
mnoaqepfkigszjijchruecbhvnmmxywbkqlktldbdwandaadaqoafmaymavojgabmeldlnoxpiaablplkbcmqaablamhklfrnttanrlbasnhalaokatmckrkpcjzgcjmpsxihkndproroammopaogfogfayaabaapglpazoboforkhbadledncnvqfisoppojaaaibuurnbufmkllipajcsqfrhgqpbmqlopqcmcoeatbsaflbpncqnpqoejnbnalcisngcalcrjneeckphbnwpjgtoodassusqsfaaniorv...
result:
ok 5 lines
Test #11:
score: 0
Accepted
time: 56ms
memory: 20360kb
input:
1 200000 155141 0 1 2 3 3 5 6 6 8 9 9 10 11 12 14 15 16 17 18 19 16 20 22 20 24 25 25 25 27 28 29 31 31 33 23 33 34 36 37 32 38 40 39 35 42 45 38 38 45 46 50 36 48 52 53 48 55 49 55 58 54 52 59 57 50 65 51 64 66 61 67 71 65 66 68 72 66 76 74 77 68 65 81 76 84 83 75 81 77 80 90 85 88 92 94 76 93 96 6...
output:
aaabaabaaabaaaaabaaaabaaacabaaababaaaaaaaaaaaabcbabbababbaaaaaaaaaaabaaababacbaaacbcaaaabaaaaaaaaaaababaabbabaaaacabbaabaaaacabaaaaabaaacaabbabababbaabaaabaaaabaaaacabaaaaaaaaabbbbabbabaaabaaaabbaaebababdacbbbbacbacaabcaaaabdbcbcaaababbcaaaababaccaaaabbcaaaaabaaaaaaaaaaaaabaaaaaaaabaabbbbcaaaaaabbaa...
result:
ok single line: 'aaabaabaaabaaaaabaaaabaaacabaa...cbdaadebaadaaaaaacbabaababaabac'
Test #12:
score: 0
Accepted
time: 59ms
memory: 19632kb
input:
1 200000 164056 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 3 0 0 0 1 0 0 1 1 1 2 1 0 0 0 1 0 9 5 1 1 0 6 1 8 4 16 2 0 3 4 2 11 1 4 3 6 2 2 2 0 4 5 5 7 17 4 4 15 4 6 0 2 55 7 55 9 8 66 3 55 1 1 6 7 5 6 69 4 76 1 21 85 2 4 1 7 73 1 2 12 8 19 4 2 5 11 12 2 10 102 1 10 29 5 10 1 19 4 12 16 9 1 28 58 105 34 10 14...
output:
hagiokfshxgcnjrfylwcpebvtaidddlulqheuqtcoenaemkpagrdmaijleodfakjbeklzqcqfcceaakjbgikjiebhgkvsbdyromdemghickepfjjjnfljfjwgjfcgaaxhogiuocnhevhaffljgfhgnahchfleeaiarhfvbqkifaaoamokdsgkhzmeqgengjldegjmkgogjfiazvjhjpbbsiiimtmibmafmatsmcgahaxpgfikdaibimqisfmghihgjqprhuienaednmgkimuyagboxthknsphnxejanctwna...
result:
ok single line: 'hagiokfshxgcnjrfylwcpebvtaiddd...dcbdcahaiqipagkfahhabfhcafbdbif'
Test #13:
score: 0
Accepted
time: 63ms
memory: 20096kb
input:
1 200000 176126 0 0 2 1 3 5 5 7 5 8 4 10 7 11 8 7 13 10 12 14 18 18 14 17 14 8 19 19 10 25 16 25 29 16 28 10 31 14 21 22 37 39 28 38 16 23 18 43 15 46 38 36 51 16 40 50 28 38 45 36 48 51 33 54 40 30 50 54 53 25 65 62 65 12 46 44 68 34 53 56 48 79 56 61 42 64 53 74 75 79 84 46 40 54 87 55 49 82 54 52...
output:
abababaccaaababaadadbceaccbacbbcaddbbfbaaaaacaaaaacaaabacbababacaabdcdabcbbaaabcbbbcaaacaccccaacabbabababadababbcccabaadcbbaaaadbbaaaacdbbaecaacaabeccbdaaaaacdbaecdaceaabbdcabbdbccfbaaadabbaaabebfbaabdabbbcacacbbabbbaebbaebabbaaabcaaeabaaadaccaaaabaabaaaecbaaaeabaadbabcbaaaaaabbbdbcaeaabccbbbdacaaba...
result:
ok single line: 'abababaccaaababaadadbceaccbacb...aabbcaaaaacgababadababacaaaaabb'
Test #14:
score: 0
Accepted
time: 67ms
memory: 19808kb
input:
1 200000 196662 0 0 0 0 3 1 2 2 3 3 0 1 2 0 12 7 0 11 4 10 17 7 10 1 7 15 6 19 2 0 7 17 8 11 18 10 17 14 2 4 5 6 12 38 15 23 3 0 13 17 4 7 20 6 47 18 25 7 14 35 19 14 10 19 11 15 6 19 31 57 5 9 39 41 43 16 14 15 6 50 32 21 46 1 33 36 18 56 14 8 4 12 4 28 38 67 51 59 16 29 16 20 32 2 15 48 29 59 88 4...
output:
cbafbbabcadadeavgoabccadbafacuabbaecdceddbbddadhcachaebaanabcedfceadaabccbbcbccaaaacbcbadafdbaepbabaafbflcbbabeabefaefccaiacdbaefdcgvacbabaahbbacbbibbaecacbdaaajbddbcadbebacgaabbcaebfmbabgnagbaacababaldbeaecaacaaadbabaaabfaaacbaabcddbadpfafabcbcaedbcdiededacafdedobdabdbarbbbbaafbcagabbgbeebdbbahcaaa...
result:
ok single line: 'cbafbbabcadadeavgoabccadbafacu...dabaacbcaabbccbahaiabbgeabdabaa'
Test #15:
score: 0
Accepted
time: 75ms
memory: 20616kb
input:
1 200000 147291 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 43 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 61 64 64 66 67 67 69 69 70 72 73 74 74 76 76 78 79 80 81 81 82 81 85 86 87 88 88 90 91 91 93 93 95 94 97 ...
output:
aaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaabaaabababaaaaabbaaaaacabaaaabaabbaaaaaaabcaabaabaaaaaaabaabbaaaabaaabaabaabaabacabaaaaabaaabaaaabaaacabbaaaaabbabaaaaabaaaacbaabaaabaabaababaaaabbaabaaaabbaaaaaabaaaabaacaaabaaabacaaabaaaaaaaaabcabaabaabaabcaababaaaaabbbaaaaaabbacaabcbbdaa...
result:
ok single line: 'aaaaaaaaaaaaaaaaaaaaaaabaaaaaa...aaaaaaaabaabaadbaabbbabaaaaaaaa'
Test #16:
score: 0
Accepted
time: 53ms
memory: 20064kb
input:
1 200000 136669 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 17 15 28 27 20 9 25 12 21 22 31 28 27 20 29 1 28 29 1 46 41 44 42 46 27 49 42 1 49 40 41 1 52 55 57 52 59 42 46 43 42 1 52 61 67 49 58 68 55 58 53 71 72 1 75 1 1 2 65 82 62 71 2 75 2 81 75 76 84 88 92 75 1 1 83 97 1 84 92 1 94 107...
output:
kpqmafwuoygcihnelrsbtvbdjzxjrmmaalleljjlgepkholakioammjlakugnjjhlbjagibakksbabmkkpmdodimkinbnbpbknoniarfaacqnlexannpapqqanqrmqnqaqaablkpvabhrawaaqapeuaaumssbzvadsufysjpurtjastvhoydsaataraubsqtsaqaovfbtbnhnrropozmcaxfqsevrwoutvtpsbbwzianavatredbclayaetzopdraabsbtpqgvcsysraunbtsrssrttsblrptoxrkavraxta...
result:
ok single line: 'kpqmafwuoygcihnelrsbtvbdjzxjrm...paabaaaababjaabaanaablbsgaaqaaa'
Test #17:
score: 0
Accepted
time: 54ms
memory: 29148kb
input:
1 200000 75359 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...
output:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
result:
ok single line: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...baaacabbbaaaaaaabaaaaaaaaaaaaba'
Test #18:
score: 0
Accepted
time: 48ms
memory: 20484kb
input:
1 200000 182195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 10 7 5 17 22 10 26 19 19 24 22 32 17 31 40 17 31 36 45 25 47 28 27 36 49 50 43 31 52 33 56 48 38 46 54 45 53 62 42 61 59 57 45 60 46 68 73 74 65 74 75 63 76 69 72 61 77 82 63 63 67 66 77 69 70 76 90 89 72 81 73 73 98 81 79 81 92 ...
output:
xgqintjmsfuhkzwvcadyrbpleobabebacayabbbcbaacacaaaxxabaaabaaaaaaaaavawbabaaabvcxcbcwcbcabcadcbaabacbaxdwbbfcaaeacbfacadabbadbdbeaaaaicbcabfcaaabacbaaaebbdabcbaaaaaaabbebabcdbaabcbbacabbacabbaaaaaaabaaabaaabaaaaaabaaabbaaabaabbbacaaaaabaaaaaccababababdbabbaaaacaaabbaaabababaaabaaaabaaaababbaaabcaaaaaa...
result:
ok single line: 'xgqintjmsfuhkzwvcadyrbpleobabe...aabaacaaabbbaaabcbabcbaaabdaccb'
Test #19:
score: 0
Accepted
time: 43ms
memory: 45196kb
input:
1 200000 93047 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...
output:
caaabbaabbbaaaaaaacabbbbabaaaaacaabaaabbababaacabaaaaaacacabbaaabbbaabaaabbabbababbcbaaaacbacaaaaabaabacabaaaaaaaaabaaaaaabaabbaabaacacabaaaaabaaaaaaabbabaacaacabbaabbbbbabbacbaaabbabbaaaaacabbaaacaaabaaaaabaaababaaaaaaaaabaaaaacabbcabababaabbabcabaabaaaaabbaacaaababadbbbabbabbaaaaaabaaaaababaaaabab...
result:
ok single line: 'caaabbaabbbaaaaaaacabbbbabaaaa...acaaaabaaababbaacbaaaabaaaaaaab'
Test #20:
score: 0
Accepted
time: 30ms
memory: 24184kb
input:
1 100000 42640 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...
output:
acaabdababaabcbaaabaababcbbaaaababababbbaaabbacabaabaaacbebabbacaababaaabbacabaababaaababaaabbaabcaaaaaacaaaaabacaaabababaababbbbacaaaabbaabaabbbbbbaababadaaabcbcaabbaaabcaaaabaaaaacabbaaaaccbaabbbbbaaabaabaaaabbcbabbaaaaababbcaabbabaacadaaaaaaacaabaaaccbbbbabacaabbabaaacabaabababbbababcabbcbaaaabab...
result:
ok single line: 'acaabdababaabcbaaabaababcbbaaa...aaaadacaacabaacaaabbaacbaabaabb'
Test #21:
score: 0
Accepted
time: 68ms
memory: 45216kb
input:
1 199999 105866 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...
output:
aaadaaaabababaabaaaaccbababcababbabbbaaaabbaabbabceaaaacacbaabaabebabaaaabbabaacbaadaaaaadbabaaaabaaabaabbabbbbabaaabaacabaaaaababaabbaaabaabcaacbaabaaaadbcaaacabaaaababaaacababaaababaacaacaabaacbaaabababaaabaaacaaaadbaabaacacbaaababaacaaaaaaaaaaabcaababbbaabaaaaabaaaabadaabaaaaaaaaaaaaacccbabcbcaac...
result:
ok single line: 'aaadaaaabababaabaaaaccbababcab...aabbbbaacbaaaaaaabaacaaaaabaabb'
Test #22:
score: 0
Accepted
time: 65ms
memory: 45300kb
input:
1 199992 158872 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...
output:
aaaaaaababacaaaadaaaabaaaabaaaaaabbaaaaaaaaaaaaaaabaaadaaaadaaaaaaaaaaabaaaaaaaaaaaaaabaaaabaaaaabbaaaabbaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaababcabaabaaabaaaaaaaacaabaaabaaaaaaaaadaaaaaabaaaaaacaabacaacabaacaaababaaaabaaaaaaabaaaaacacaaaaaaaaaaacaaabababbaaaaabaaaaabaabaaaaaaaaaaaaaaaaaaaaa...
result:
ok single line: 'aaaaaaababacaaaadaaaabaaaabaaa...aadacdbaabbbabaabaacaaaabadbacb'
Test #23:
score: 0
Accepted
time: 46ms
memory: 19124kb
input:
1 200000 107064 0 1 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 47 47 48 48 49 49 50 50 ...
output:
aabbababaabbaababbaabababbabaabbabababababababaabbabaabbaababababababbababaabbaababababababbababababaabbaabababbaabbaabbababaabababbaabbabababaabbabaabbababaabbabaabbaabbabaababbabaabbabaabbaabbabaabbaabbaabababbabaabbaabababababbaabbaabbabababaababababbabaababababbaabababababbaabababbaabbabaabbaaba...
result:
ok single line: 'aabbababaabbaababbaabababbabaa...abababababababababababababababa'
Test #24:
score: 0
Accepted
time: 41ms
memory: 19992kb
input:
1 200000 142365 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 26 26 26 27 27 27 28 28 28 29 29 29 30 30 30 31 31 31 32 32 32 33 33 33 34 34 34 3...
output:
bacabcabbcacabcabcabacbbacabcbacacbacbbcacbacabcbabacbcacabbaccbaabccbaabcacbabcabccbaabccbacabacbbacbcaabcbacacbacbbacabcbcabacbacabccabacbcabcbaacbcabacbabcbaccbacbabcabacbcacbacbacabcabacbacbbaccbacabbcaacbabccabbaccbabacbcabcacabacbcbaabcbcacababcacbacbcabcbacbaabcbcacabbcacbaabcabcbcaacbbacbcab...
result:
ok single line: 'bacabcabbcacabcabcabacbbacabcb...cabcabcabcabcabcabcabcabcabcabc'
Test #25:
score: 0
Accepted
time: 42ms
memory: 20244kb
input:
1 200000 181860 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 10 10 10 10 10 11 11 11 11 11 12 12 12 12 12 13 13 13 13 13 14 14 14 14 14 15 15 15 15 15 16 16 16 16 16 17 17 17 17 17 18 18 18 18 18 19 19 19 19 19 20 20 20 20 20 21 21 21 21 21 22 22 ...
output:
bdacadbceacbdeabdecebcdadcebacaedbadcbebaedcdcbaedceabacedbedcabbdeacbadeccebadaebcdedacbadbceabdecdcbaedecabadcebedabceadcbcedabbadecaecdbacdebdebaccdbeabacedbacdebcdaecdeababcdedcabebdeacbaceddabecdacbecedbacbdaeedcabebadcbadecdbecaeacbdadebcecabdbecadbcdeaacbededcabeacdbabdecdacebdcbeadbceabcadee...
result:
ok single line: 'bdacadbceacbdeabdecebcdadcebac...abcdeabcdeabcdeabcdeabcdeabcdea'
Test #26:
score: 0
Accepted
time: 32ms
memory: 18812kb
input:
1 200000 199316 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 ...
output:
evabgfxdhcwirjsntuokyplmqcudhevqijfkgrlwmnostaxpbzyajbkolcdepvfxtqwrszghiumynuemzfnvgaohpqxrwibycdstjkltaydwzijuefkoplmbnqgrchsxvmszabgnhticxwjduvkyeflopqrbmnoacgduthipvwjkyelxqzfrsndexfowakbpczsghqyturijlmvicjkdlerxmabnsfvytghopuwzqflmawngopvqrhbziscjdextukyldgmzastnopuqveyhwijxbckfrbfiagjcdehklmno...
result:
ok single line: 'evabgfxdhcwirjsntuokyplmqcudhe...efghijklmnopqrstuvwxyzabcdefghi'