QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#344529 | #8213. Graffiti | Crysfly# | AC ✓ | 154ms | 68432kb | C++17 | 4.4kb | 2024-03-04 18:41:57 | 2024-03-04 18:41:57 |
Judging History
answer
// what is matter? never mind.
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define mod 1000000007
struct modint{
int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,modint b){return a.x==b.x;}
friend bool operator !=(modint a,modint b){return a.x!=b.x;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 300005
#define inf 0x3f3f3f3f
int n,res;
string s;
vi e[maxn];
string op;
int F(int x){
if(op=="ABA") return x*(x-1);
if(op=="ABC") return (x/2)*(x-x/2);
exit(233);
}
int F2(int x,int y){
return x*y;
}
// self , fa
int f[maxn][2][2];
void dfs(int u,int pa){
int s[2]={0,0};
vi p[2];
for(int v:e[u]){
if(v==pa)continue;
dfs(v,u);
For(j,0,1) {
s[j]+=f[v][0][j];
p[j].pb(f[v][1][j]-f[v][0][j]);
}
}
For(j,0,1) sort(ALL(p[j]),greater<int>());
// cout<<"u: "<<u<<"\n";
For(i,0,1) For(j,0,1) {
int now=p[i].size(),sum=s[i];
f[u][i][j]=sum+(i?F((!j)+now):0ll);
for(int k:p[i]){
--now;
sum+=k;
f[u][i][j]=max(f[u][i][j],sum+(i?F((!j)+now):0ll));
}
}
if(u==1) res=max(f[u][0][1],f[u][1][1]);
}
void dfs2(int u,int pa){
int s[2]={0,0};
vi p[2];
for(int v:e[u]){
if(v==pa)continue;
dfs2(v,u);
For(j,0,1) {
s[j]+=f[v][0][j];
p[j].pb(f[v][1][j]-f[v][0][j]);
}
}
For(j,0,1) sort(ALL(p[j]),greater<int>());
For(i,0,1) For(j,0,1) {
int now=p[i].size(),sum=s[i],sz=p[i].size();
f[u][i][j]=sum+(i?F2((!j)+now,j+sz-now):0ll);
if(u==1) res=max(res,sum+(i?F2(now,sz-now):0ll));
for(int k:p[i]){
--now;
sum+=k;
f[u][i][j]=max(f[u][i][j],sum+(i?F2((!j)+now,j+sz-now):0ll));
if(u==1) res=max(res,sum+(i?F2(now,sz-now):0ll));
}
}
}
void work()
{
n=read();
cin>>s;
For(i,2,n){
int u=read(),v=read();
e[u].pb(v),e[v].pb(u);
}
if(s.size()==1){
cout<<n<<"\n";
}
else if(s.size()==2){
if(s[0]==s[1]) cout<<2*(n-1)<<"\n";
else cout<<(n-1)<<"\n";
}
else{
if(s[0]==s[1] && s[1]==s[2]){
int res=0;
For(i,1,n) res+=e[i].size()*(e[i].size()-1);
cout<<res<<"\n";
return;
}
else if((s[0]==s[1] && s[1]!=s[2]) || (s[1]==s[2] && s[0]!=s[1])){
op="AAB";
}
else if(s[0]==s[2] && s[0]!=s[1]){
op="ABA";
}
else {
For(i,0,2)For(j,i+1,2)assert(s[i]!=s[j]);
op="ABC";
}
if(op=="AAB")dfs2(1,0);
else dfs(1,0);
cout<<res<<"\n";
}
}
signed main()
{
int T=1;
while(T--)work();
return 0;
}
/*
*/
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 11408kb
input:
1 a
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 11364kb
input:
3 orz 1 2 2 3
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 2ms
memory: 11856kb
input:
2 ab 1 2
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 2ms
memory: 12552kb
input:
5 bob 3 2 5 1 1 4 2 4
output:
4
result:
ok 1 number(s): "4"
Test #5:
score: 0
Accepted
time: 2ms
memory: 11108kb
input:
50 abc 23 14 24 25 1 3 47 46 2 26 22 41 34 19 7 14 50 24 29 38 17 25 4 26 35 37 21 14 11 4 13 27 8 25 5 10 20 27 44 27 15 39 19 9 30 12 38 27 39 27 41 40 14 48 32 7 16 37 3 13 42 5 48 27 49 25 6 5 26 9 31 17 36 7 43 29 9 5 45 9 18 9 40 42 27 5 25 42 46 10 37 42 12 48 28 26 33 5
output:
37
result:
ok 1 number(s): "37"
Test #6:
score: 0
Accepted
time: 0ms
memory: 11124kb
input:
50 abc 14 26 46 47 10 13 30 19 33 46 32 50 39 6 35 13 8 5 28 3 2 21 17 22 22 6 5 20 19 3 38 3 16 2 18 34 13 6 47 6 9 28 1 2 37 47 50 10 12 34 40 19 42 19 26 46 43 3 44 47 31 47 49 18 45 34 27 13 7 34 6 34 3 45 11 44 21 13 29 24 15 40 48 39 24 6 41 47 23 27 36 21 25 21 4 20 20 44
output:
37
result:
ok 1 number(s): "37"
Test #7:
score: 0
Accepted
time: 0ms
memory: 11780kb
input:
50 abc 11 3 14 46 37 47 18 33 12 46 40 41 23 17 49 48 27 26 13 5 26 41 43 16 25 47 46 9 39 13 38 4 36 18 28 40 50 26 10 38 9 50 15 6 24 16 19 16 48 26 6 50 31 16 29 16 7 26 35 14 17 46 21 5 22 38 2 15 4 17 30 34 16 41 45 17 47 50 44 16 33 26 32 34 1 25 3 46 20 16 5 32 42 14 8 48 41 34
output:
44
result:
ok 1 number(s): "44"
Test #8:
score: 0
Accepted
time: 0ms
memory: 11608kb
input:
50 abc 9 7 43 49 26 3 14 11 17 43 23 35 19 25 44 25 2 1 10 28 4 46 21 22 15 43 39 25 16 38 38 23 34 29 47 49 46 35 5 39 25 35 32 23 27 37 3 32 37 24 20 13 33 25 1 29 30 11 31 34 18 31 50 37 13 48 22 23 8 10 41 24 42 46 36 37 48 43 49 31 40 41 12 35 24 34 45 7 35 31 7 31 11 44 28 1 6 19
output:
34
result:
ok 1 number(s): "34"
Test #9:
score: 0
Accepted
time: 2ms
memory: 12196kb
input:
50 abc 31 6 36 20 32 42 47 14 24 21 27 39 14 22 26 47 44 45 30 28 15 18 1 14 42 38 20 35 17 25 4 18 25 47 40 3 28 7 48 33 2 41 10 33 22 38 41 38 9 40 35 41 16 45 49 32 19 28 21 32 34 29 46 25 13 14 23 15 3 38 18 12 45 35 29 20 43 18 6 3 8 12 12 41 50 12 7 42 5 36 33 36 39 16 11 16 37 41
output:
30
result:
ok 1 number(s): "30"
Test #10:
score: 0
Accepted
time: 3ms
memory: 12148kb
input:
50 abc 50 18 10 32 38 18 47 13 31 6 49 18 45 47 42 4 7 18 18 27 36 13 12 13 41 12 35 8 6 40 16 8 4 22 14 44 25 2 28 18 3 27 34 32 5 27 43 5 33 11 23 24 2 18 21 39 46 5 8 49 32 19 20 28 22 12 11 5 15 38 44 7 9 5 19 49 1 16 30 50 48 25 40 11 24 27 26 5 37 50 17 24 13 5 39 26 29 27
output:
38
result:
ok 1 number(s): "38"
Test #11:
score: 0
Accepted
time: 0ms
memory: 11836kb
input:
51 abb 7 35 1 48 32 42 45 15 13 39 14 43 9 2 34 37 23 24 47 36 36 35 41 22 50 49 49 44 28 42 48 43 20 37 22 21 10 38 6 35 29 17 35 24 19 51 21 44 38 4 11 17 33 42 37 50 44 38 12 17 43 38 3 49 8 12 16 49 5 15 40 31 24 4 15 50 39 44 42 35 27 21 51 50 18 13 30 4 26 29 31 22 46 49 17 38 25 49 2 26
output:
54
result:
ok 1 number(s): "54"
Test #12:
score: 0
Accepted
time: 3ms
memory: 12236kb
input:
51 abb 4 33 29 28 44 34 31 46 46 17 27 48 25 35 45 19 36 40 35 51 22 36 43 9 26 47 21 36 12 17 51 50 13 44 3 34 19 36 15 32 47 28 1 3 2 40 33 46 5 30 48 39 41 15 8 20 14 46 34 27 40 17 24 2 38 10 9 17 30 19 32 17 16 21 23 9 42 34 6 15 10 31 11 28 18 34 49 40 37 34 50 19 28 17 39 40 20 19 7 24
output:
57
result:
ok 1 number(s): "57"
Test #13:
score: 0
Accepted
time: 3ms
memory: 12548kb
input:
51 abb 27 37 40 37 33 22 3 29 9 28 14 28 38 17 49 47 36 29 46 10 6 11 11 47 37 18 20 22 39 28 29 28 1 7 32 42 24 30 2 45 16 7 45 29 42 39 43 42 5 37 22 49 34 31 4 29 30 22 41 29 18 22 50 22 25 28 7 42 26 30 51 14 19 13 8 49 35 22 48 14 12 42 21 35 23 50 44 42 31 22 13 39 17 37 10 31 15 37 28 49
output:
70
result:
ok 1 number(s): "70"
Test #14:
score: 0
Accepted
time: 3ms
memory: 11784kb
input:
51 abb 7 43 11 39 8 5 47 44 25 49 9 30 40 3 36 17 13 41 16 50 44 10 12 7 33 44 5 2 35 7 22 45 19 43 18 32 42 19 31 10 45 29 3 19 46 48 39 2 34 25 14 43 2 19 21 7 32 16 51 27 6 24 43 41 27 32 48 15 23 43 17 16 50 43 24 28 1 13 38 19 37 19 49 2 26 10 28 43 30 19 4 22 20 42 15 19 29 44 10 19
output:
63
result:
ok 1 number(s): "63"
Test #15:
score: 0
Accepted
time: 2ms
memory: 11756kb
input:
51 aba 44 6 9 7 1 50 24 38 26 11 30 2 6 21 34 43 49 11 13 4 42 21 5 38 22 3 18 3 45 34 28 26 38 43 27 21 37 27 16 42 2 23 43 21 32 21 29 28 19 13 51 13 15 40 20 1 36 46 10 3 12 11 25 21 47 6 33 7 39 22 4 38 8 27 35 38 48 50 41 31 50 21 31 26 23 26 17 24 40 21 46 44 7 32 3 8 11 43 14 11
output:
132
result:
ok 1 number(s): "132"
Test #16:
score: 0
Accepted
time: 0ms
memory: 11960kb
input:
52 aba 19 7 11 48 4 6 5 27 46 50 6 37 50 23 12 40 37 23 13 23 32 38 22 44 52 5 34 50 26 38 35 10 51 20 7 26 41 6 15 26 39 10 10 40 3 50 33 29 30 14 45 50 14 27 21 27 42 29 49 44 31 27 18 5 36 42 16 11 29 28 24 12 8 50 38 5 43 10 48 52 1 52 47 26 40 32 2 3 44 27 28 38 20 26 23 5 17 27 9 43 25 46
output:
116
result:
ok 1 number(s): "116"
Test #17:
score: 0
Accepted
time: 0ms
memory: 11704kb
input:
52 aba 10 43 2 40 24 9 47 35 42 44 1 18 7 18 3 40 28 4 52 25 6 13 33 18 35 19 49 2 16 39 26 3 32 8 4 44 50 22 11 30 41 6 19 39 18 39 14 36 34 44 36 4 17 34 45 21 12 17 25 36 51 39 29 8 30 23 9 8 46 11 37 2 23 13 20 13 44 51 15 37 43 27 40 51 31 3 5 10 22 18 8 44 21 23 27 30 38 28 13 39 48 25
output:
88
result:
ok 1 number(s): "88"
Test #18:
score: 0
Accepted
time: 2ms
memory: 12096kb
input:
52 aba 48 38 40 22 49 23 37 3 6 12 43 42 26 22 30 39 8 7 25 7 47 41 44 11 52 1 13 1 41 14 19 41 23 39 35 13 32 19 38 13 39 41 2 27 51 21 31 19 21 9 29 36 9 39 16 27 15 22 24 42 18 30 42 9 36 30 4 7 27 9 17 5 22 9 50 30 20 16 46 52 28 21 5 16 3 1 33 22 7 28 10 21 12 34 34 39 11 39 1 11 45 11
output:
112
result:
ok 1 number(s): "112"
Test #19:
score: 0
Accepted
time: 0ms
memory: 12448kb
input:
52 aba 46 45 42 45 18 27 3 44 16 25 39 24 40 10 33 32 19 31 13 1 27 45 25 9 23 2 29 14 24 8 21 52 14 37 17 24 15 9 41 24 43 31 38 7 4 52 45 7 50 1 6 40 49 22 37 52 11 23 48 7 5 2 10 1 2 48 8 7 36 22 26 28 44 23 34 13 9 7 31 26 12 8 52 48 47 3 30 40 20 25 7 22 1 26 28 52 51 26 32 45 35 30
output:
106
result:
ok 1 number(s): "106"
Test #20:
score: 0
Accepted
time: 2ms
memory: 11336kb
input:
52 aba 36 34 23 29 28 11 2 47 33 26 16 37 27 46 52 3 8 14 44 15 51 47 37 7 34 29 50 27 12 47 6 18 20 21 17 14 18 13 10 3 49 17 13 3 42 22 30 13 46 43 5 19 9 18 11 14 38 51 21 46 40 50 39 19 48 22 43 19 24 19 19 14 22 41 45 37 15 41 26 11 31 46 4 43 35 15 3 19 41 43 32 11 29 47 1 7 47 43 7 14 25 28
output:
104
result:
ok 1 number(s): "104"
Test #21:
score: 0
Accepted
time: 38ms
memory: 23196kb
input:
300000 z 180011 260532 271217 191245 41791 255746 290587 278534 218547 277068 139010 241751 243632 263417 248223 222193 89717 215179 251082 231639 117314 8572 245286 297248 168750 266280 80957 255206 73540 12700 170796 282744 214088 139101 299056 232065 3541 39425 245901 203384 4354 21447 106700 295...
output:
300000
result:
ok 1 number(s): "300000"
Test #22:
score: 0
Accepted
time: 62ms
memory: 22160kb
input:
300000 aa 145612 276393 88541 108216 226040 100484 260244 139556 150893 213849 85295 33531 270499 248769 5250 51884 24539 76804 254304 165858 85779 118908 183955 155461 5230 80950 80213 95224 58182 122060 46066 288552 138127 46553 186220 182641 21451 14106 193341 35522 269820 212259 208311 40745 229...
output:
599998
result:
ok 1 number(s): "599998"
Test #23:
score: 0
Accepted
time: 7ms
memory: 16916kb
input:
123234 ab 5333 65911 93667 3824 117784 113995 122335 34180 100563 13017 2356 55265 68248 30680 67326 55966 55450 2923 86794 12061 49667 54440 46800 106814 4840 7419 53069 122499 34188 99215 18873 90062 115319 82268 1093 52619 108703 107429 40381 14308 91251 53870 7680 94995 90630 57256 78084 11866 3...
output:
123233
result:
ok 1 number(s): "123233"
Test #24:
score: 0
Accepted
time: 61ms
memory: 22484kb
input:
300000 aaa 286864 6103 13963 130993 193857 266146 21588 192178 60950 206316 57174 172746 83177 159553 274512 266893 1479 82701 149984 220249 66444 38360 164961 269188 90561 160425 48372 223724 176008 89731 146829 119384 4625 131173 271552 74420 258647 63612 101816 202418 73996 284875 167169 62661 18...
output:
1202694
result:
ok 1 number(s): "1202694"
Test #25:
score: 0
Accepted
time: 130ms
memory: 31180kb
input:
300000 wow 33050 101378 38107 258970 169311 109231 147923 297962 291294 116868 35054 53343 198452 192697 213787 257591 188731 256973 281711 199138 234546 68112 204998 251624 97110 216134 250244 200876 285877 202008 173953 211734 40140 26823 71958 217939 219546 251422 128294 208345 55792 155 162308 2...
output:
691046
result:
ok 1 number(s): "691046"
Test #26:
score: 0
Accepted
time: 136ms
memory: 31152kb
input:
300000 bob 3546 155583 136408 83861 111087 14272 247003 298086 108933 172420 164224 266023 111269 244728 113434 88159 133416 293100 147988 29901 261668 83495 56261 94204 102384 32287 226850 127102 206891 175776 943 283177 269178 25048 239910 24108 129685 205836 12217 98902 256855 9020 289624 267084 ...
output:
691252
result:
ok 1 number(s): "691252"
Test #27:
score: 0
Accepted
time: 110ms
memory: 31144kb
input:
300000 oop 262845 173800 283177 94631 297757 21360 86111 283443 104846 44242 146147 80602 172254 3094 18207 36330 116034 170256 241960 205186 70178 78225 70995 118475 205702 210175 286804 82561 5920 218263 217010 270658 109005 165733 173532 245803 234143 242996 183220 280923 42808 252787 103082 6893...
output:
348991
result:
ok 1 number(s): "348991"
Test #28:
score: 0
Accepted
time: 118ms
memory: 31100kb
input:
300000 oos 158458 247120 215157 159784 190471 66394 225576 159695 222028 284149 69459 291819 104663 249330 134213 136364 292122 146754 161582 230625 4737 11321 142504 132425 134469 262394 84723 70355 80305 263063 222422 44698 31451 144527 298650 156797 78134 132399 179955 167441 121608 279696 216497...
output:
349007
result:
ok 1 number(s): "349007"
Test #29:
score: 0
Accepted
time: 116ms
memory: 31448kb
input:
300000 abc 4174 107937 25641 152603 166647 202303 189981 116183 38101 253954 200667 270084 92355 16289 105807 31793 66251 182931 241831 54962 219999 131702 115262 113029 270453 293159 154812 272614 113516 169827 241547 176927 134511 246966 121893 96209 177380 62362 171167 69663 88807 191054 143481 2...
output:
223787
result:
ok 1 number(s): "223787"
Test #30:
score: 0
Accepted
time: 112ms
memory: 31220kb
input:
300000 abc 113434 183575 266163 293872 157144 154976 19254 140009 22337 193389 126948 94997 35183 51349 49306 205114 23285 17007 102888 60814 251124 15778 81475 577 154714 132031 160199 147123 218636 192415 224898 112619 60420 96439 227539 116775 61422 252118 160645 55590 98410 242424 211690 186532 ...
output:
223963
result:
ok 1 number(s): "223963"
Test #31:
score: 0
Accepted
time: 140ms
memory: 31248kb
input:
300000 abc 289613 168106 298323 1639 94906 259178 94266 171633 1382 196237 101928 3668 277753 53877 57008 160208 22937 104028 49838 176863 298867 236970 278442 190357 187040 189393 87769 101436 194395 52339 229441 102044 117905 88794 299914 87313 8175 382 56268 19725 281472 177140 203962 1783 13337 ...
output:
224383
result:
ok 1 number(s): "224383"
Test #32:
score: 0
Accepted
time: 66ms
memory: 36572kb
input:
300000 wow 22595 236057 46076 96541 153734 236057 27444 8366 234776 220242 242135 236057 64816 96541 139070 236057 201587 96541 153838 8366 195075 236057 3139 96541 30778 236057 120886 8366 196547 236057 285318 96541 112803 236057 124641 236057 156677 96541 182925 236057 219017 236057 293816 236057 ...
output:
29997876248
result:
ok 1 number(s): "29997876248"
Test #33:
score: 0
Accepted
time: 60ms
memory: 37072kb
input:
300000 bob 16943 287190 103934 140616 219255 140616 194097 287190 83757 287190 44264 140616 242197 43126 278554 43126 263701 43126 233062 287190 11137 287190 260137 287190 17644 287190 92528 287190 34053 287190 33629 140616 72793 140616 94224 43126 276882 287190 221306 287190 155179 287190 244478 14...
output:
30014090562
result:
ok 1 number(s): "30014090562"
Test #34:
score: 0
Accepted
time: 65ms
memory: 35908kb
input:
300000 oop 107676 272608 143823 193569 43853 193569 105266 143811 287695 193569 263862 193569 236976 193569 165496 193569 57461 143811 245073 197653 202476 256881 27321 197653 133560 256881 266612 256881 99005 193569 256358 272608 47238 256881 157044 256881 215838 256881 211729 193569 195126 256881 ...
output:
7504186975
result:
ok 1 number(s): "7504186975"
Test #35:
score: 0
Accepted
time: 60ms
memory: 37232kb
input:
300000 oos 190608 202209 283844 138697 52495 202209 39486 202209 33204 202209 206746 199308 253195 120518 215584 203689 295312 202209 47406 120518 257824 202209 87430 120518 202831 120518 122370 120518 80886 120518 52761 202209 206684 202209 24175 199308 84272 202209 173350 203689 123871 202209 2532...
output:
7505713580
result:
ok 1 number(s): "7505713580"
Test #36:
score: 0
Accepted
time: 53ms
memory: 37184kb
input:
300000 abc 180558 130554 190415 62483 188833 154596 12577 154596 10040 154596 188041 193289 144867 62483 28782 62483 62648 154596 140168 154596 63040 154596 171779 154596 88474 130554 224190 193289 171925 130554 82669 62483 39058 154596 82100 154596 281425 130554 159133 130554 186912 130554 261234 1...
output:
7501191205
result:
ok 1 number(s): "7501191205"
Test #37:
score: 0
Accepted
time: 67ms
memory: 36056kb
input:
300000 abc 89940 76587 57550 140890 67497 282512 180084 140890 76270 282512 146642 282512 273626 282512 157430 140890 59710 140890 64702 76587 198400 282512 219947 140890 171793 282512 95126 140890 95442 140890 236935 282512 255589 140890 265049 140890 47112 282512 279042 140890 28892 161734 114714 ...
output:
7499480510
result:
ok 1 number(s): "7499480510"
Test #38:
score: 0
Accepted
time: 52ms
memory: 36408kb
input:
300000 abc 55843 241513 6609 201896 168088 201896 213110 201896 112667 201896 240505 201896 12463 201896 258900 223862 17366 201896 209285 241513 109494 223862 32174 201896 145840 201896 13649 15991 162530 15991 20851 201896 238968 15991 104041 15991 90030 201896 263404 201896 180924 241513 290286 2...
output:
7502311982
result:
ok 1 number(s): "7502311982"
Test #39:
score: 0
Accepted
time: 117ms
memory: 32900kb
input:
300000 wow 144878 259456 123359 144339 54629 223363 292585 206804 254981 207716 244303 122064 261863 282480 81385 203130 40759 68043 230775 93789 288187 36663 244992 267678 170100 235453 179746 208527 197183 138259 249778 53855 241088 84565 71067 286806 261613 104068 142358 55012 78195 226265 95646 ...
output:
599988
result:
ok 1 number(s): "599988"
Test #40:
score: 0
Accepted
time: 142ms
memory: 32908kb
input:
300000 bob 32976 187278 161818 191204 102041 584 97831 182359 106786 101596 80505 205624 188735 62291 4736 166572 74203 264123 8281 71632 45373 261684 62066 100527 146225 185109 161511 282775 90916 88435 236105 241876 57233 113158 208046 92973 290768 147151 132125 290341 90630 263121 174429 186157 2...
output:
599988
result:
ok 1 number(s): "599988"
Test #41:
score: 0
Accepted
time: 126ms
memory: 32844kb
input:
300000 oop 101151 160865 242004 164970 237489 129857 174927 216 291190 210922 187905 170089 29264 151057 194426 90376 109481 285614 252712 275710 59779 230221 194941 102633 148819 55549 261418 2973 267013 209609 105493 21469 223472 262947 249384 297650 203219 151940 261236 62031 167756 13126 106966 ...
output:
257138
result:
ok 1 number(s): "257138"
Test #42:
score: 0
Accepted
time: 133ms
memory: 33076kb
input:
300000 oos 5590 194503 144504 174363 267701 288391 115576 253898 277968 263247 182688 35056 22996 200674 94344 91103 63371 98699 115427 206084 187631 194495 190653 228398 193043 205798 101068 137835 288721 262106 1910 154566 155040 265268 227078 172467 73471 116673 9972 242363 292762 181367 103763 2...
output:
257138
result:
ok 1 number(s): "257138"
Test #43:
score: 0
Accepted
time: 148ms
memory: 32848kb
input:
300000 abc 131768 96146 62911 217112 299792 16345 89763 116462 281263 216565 114167 261642 240853 219444 228788 146702 163696 102573 189746 268225 186853 160707 22264 268466 261737 179828 29619 294202 3851 144555 250511 107975 100808 283350 63744 57074 156845 149604 153410 284405 178285 197147 78024...
output:
199996
result:
ok 1 number(s): "199996"
Test #44:
score: 0
Accepted
time: 125ms
memory: 33136kb
input:
300000 abc 53820 27527 246597 65186 196535 136227 178375 119176 34454 31566 236221 12170 264608 164729 117485 292366 267342 235869 31889 191689 161909 292876 253769 39793 85148 16614 124533 136286 236444 153507 158658 140149 119177 1891 59811 114187 281674 271793 15910 268137 160034 251432 161375 17...
output:
199996
result:
ok 1 number(s): "199996"
Test #45:
score: 0
Accepted
time: 133ms
memory: 32900kb
input:
300000 abc 12274 124429 205724 155478 33673 27003 271356 252266 57862 19114 155513 232327 104164 115181 275557 159803 277956 92071 61512 275785 146834 257653 202864 136980 188116 137376 23750 14983 231073 282690 127684 99223 260107 243785 108147 116980 56074 126220 102554 135487 61856 157095 204923 ...
output:
199996
result:
ok 1 number(s): "199996"
Test #46:
score: 0
Accepted
time: 51ms
memory: 42408kb
input:
300000 wow 144878 256650 123359 256650 54629 256650 292585 256650 254981 256650 244303 256650 261863 256650 81385 256650 40759 256650 230775 256650 288187 256650 244992 256650 170100 256650 179746 256650 197183 256650 249778 256650 241088 256650 71067 256650 261613 256650 142358 256650 78195 256650 ...
output:
89999100002
result:
ok 1 number(s): "89999100002"
Test #47:
score: 0
Accepted
time: 63ms
memory: 46224kb
input:
300000 bob 32976 107629 161818 107629 102041 107629 97831 107629 106786 107629 80505 107629 188735 107629 4736 107629 74203 107629 8281 107629 45373 107629 62066 107629 146225 107629 161511 107629 90916 107629 236105 107629 57233 107629 208046 107629 290768 107629 132125 107629 90630 107629 174429 1...
output:
89999100002
result:
ok 1 number(s): "89999100002"
Test #48:
score: 0
Accepted
time: 56ms
memory: 46584kb
input:
300000 oop 101151 128925 242004 128925 237489 128925 174927 128925 291190 128925 187905 128925 29264 128925 194426 128925 109481 128925 252712 128925 59779 128925 194941 128925 148819 128925 261418 128925 267013 128925 105493 128925 223472 128925 249384 128925 203219 128925 261236 128925 167756 1289...
output:
22499850000
result:
ok 1 number(s): "22499850000"
Test #49:
score: 0
Accepted
time: 56ms
memory: 41900kb
input:
300000 oos 5590 236324 144504 236324 267701 236324 115576 236324 277968 236324 182688 236324 22996 236324 94344 236324 63371 236324 115427 236324 187631 236324 190653 236324 193043 236324 101068 236324 288721 236324 1910 236324 155040 236324 227078 236324 73471 236324 9972 236324 292762 236324 10376...
output:
22499850000
result:
ok 1 number(s): "22499850000"
Test #50:
score: 0
Accepted
time: 61ms
memory: 45704kb
input:
300000 abc 131768 145481 62911 145481 299792 145481 89763 145481 281263 145481 114167 145481 240853 145481 228788 145481 163696 145481 189746 145481 186853 145481 22264 145481 261737 145481 29619 145481 3851 145481 250511 145481 100808 145481 63744 145481 156845 145481 153410 145481 178285 145481 78...
output:
22499850000
result:
ok 1 number(s): "22499850000"
Test #51:
score: 0
Accepted
time: 54ms
memory: 42380kb
input:
300000 abc 53820 108815 246597 108815 196535 108815 178375 108815 34454 108815 236221 108815 264608 108815 117485 108815 267342 108815 31889 108815 161909 108815 253769 108815 85148 108815 124533 108815 236444 108815 158658 108815 119177 108815 59811 108815 281674 108815 15910 108815 160034 108815 1...
output:
22499850000
result:
ok 1 number(s): "22499850000"
Test #52:
score: 0
Accepted
time: 49ms
memory: 44664kb
input:
300000 abc 12274 64791 205724 64791 33673 64791 271356 64791 57862 64791 155513 64791 104164 64791 275557 64791 277956 64791 61512 64791 146834 64791 202864 64791 188116 64791 23750 64791 231073 64791 127684 64791 260107 64791 108147 64791 56074 64791 102554 64791 61856 64791 204923 64791 82570 6479...
output:
22499850000
result:
ok 1 number(s): "22499850000"
Test #53:
score: 0
Accepted
time: 154ms
memory: 60832kb
input:
300000 wow 144878 221067 123359 273483 54629 143533 292585 230047 254981 99152 244303 157266 261863 157343 81385 37158 40759 241427 230775 215829 288187 281879 244992 72642 170100 118411 179746 206236 197183 128825 249778 110061 241088 166751 71067 281097 261613 164171 142358 74435 78195 277360 9564...
output:
299998
result:
ok 1 number(s): "299998"
Test #54:
score: 0
Accepted
time: 123ms
memory: 68432kb
input:
300000 bob 32976 69263 161818 283115 102041 204674 97831 282849 106786 221504 80505 53924 188735 156850 4736 180641 74203 93941 8281 130474 45373 259986 62066 185893 146225 232270 161511 48095 90916 182921 236105 46762 57233 73908 208046 168822 290768 231854 132125 246418 90630 175102 174429 28693 2...
output:
299998
result:
ok 1 number(s): "299998"
Test #55:
score: 0
Accepted
time: 118ms
memory: 58964kb
input:
300000 oop 101151 126762 242004 103244 237489 293734 174927 79059 291190 173300 187905 75963 29264 147267 194426 38389 109481 181180 252712 213448 59779 923 194941 163008 148819 219595 261418 72513 267013 37646 105493 122011 223472 34782 249384 109080 203219 231034 261236 61579 167756 106275 106966 ...
output:
199999
result:
ok 1 number(s): "199999"
Test #56:
score: 0
Accepted
time: 105ms
memory: 57840kb
input:
300000 oos 5590 257724 144504 283816 267701 121495 115576 295906 277968 222026 182688 137448 22996 185692 94344 137035 63371 141261 115427 37045 187631 107046 190653 135729 193043 219502 101068 21732 288721 262542 1910 103936 155040 7399 227078 5257 73471 88369 9972 140976 292762 282422 103763 11472...
output:
199999
result:
ok 1 number(s): "199999"
Test #57:
score: 0
Accepted
time: 153ms
memory: 67880kb
input:
300000 abc 131768 84282 62911 171383 299792 204843 89763 102511 281263 267317 114167 21990 240853 210296 228788 226638 163696 127891 189746 114860 186853 254275 22264 79061 261737 65003 29619 89428 3851 267250 250511 14646 100808 181862 63744 174143 156845 159905 153410 202635 178285 202500 78024 78...
output:
149999
result:
ok 1 number(s): "149999"
Test #58:
score: 0
Accepted
time: 145ms
memory: 64932kb
input:
300000 abc 53820 291690 246597 63051 196535 230681 178375 39413 34454 254790 236221 153215 264608 25587 117485 29602 267342 169354 31889 294535 161909 190738 253769 208341 85148 193710 124533 292677 236444 251817 158658 4239 119177 194315 59811 194332 281674 142883 15910 296874 160034 131276 161375 ...
output:
149999
result:
ok 1 number(s): "149999"
Test #59:
score: 0
Accepted
time: 134ms
memory: 59092kb
input:
300000 abc 12274 15292 205724 257083 33673 124315 271356 271864 57862 29391 155513 8517 104164 42782 275557 172577 277956 257748 61512 163165 146834 154485 202864 191050 188116 14141 23750 3766 231073 4131 127684 50060 260107 275248 108147 270714 56074 92565 102554 248898 61856 97301 204923 251345 8...
output:
149999
result:
ok 1 number(s): "149999"
Test #60:
score: 0
Accepted
time: 0ms
memory: 12648kb
input:
1 abc
output:
0
result:
ok 1 number(s): "0"
Test #61:
score: 0
Accepted
time: 2ms
memory: 10960kb
input:
1 ab
output:
0
result:
ok 1 number(s): "0"
Extra Test:
score: 0
Extra Test Passed