QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#529940 | #9225. Fibonacci Fusion | ucup-team112# | AC ✓ | 2565ms | 220908kb | C++20 | 12.8kb | 2024-08-24 14:25:32 | 2024-08-24 14:25:36 |
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--)
namespace template_tute{
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<ll>({a,b,c})-min<ll>({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;}
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;}
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
if (s) {
__uint128_t tmp = value < 0 ? -value : value;
char buffer[128];
char *d = std::end(buffer);
do {
--d;
*d = "0123456789"[tmp % 10];
tmp /= 10;
} while (tmp != 0);
if (value < 0) {
--d;
*d = '-';
}
int len = std::end(buffer) - d;
if (dest.rdbuf()->sputn(d, len) != len) {
dest.setstate(std::ios_base::badbit);
}
}
return dest;
}
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;
}
}
using namespace template_tute;
using ul = unsigned long long;
struct ModintHash{
static const ul mod = (1LL<<61) - 1;
static const ul add = mod * 4;
ul x;
ModintHash() : x(0) {}
ModintHash(ul y) : x(calcmod(y)) {}
ModintHash &operator+=(const ModintHash &p) {
if((x += p.x) >= mod) x -= mod;
return *this;
}
ModintHash &operator-=(const ModintHash &p) {
x = calcmod(x + add - p.x);
return *this;
}
ModintHash &operator*=(const ModintHash &p) {
x = mul(x,p.x);
return *this;
}
ModintHash operator-(){ return ModintHash(add-x);}
friend ModintHash operator+(const ModintHash& lhs, const ModintHash& rhs) {
return ModintHash(lhs) += rhs;
}
friend ModintHash operator-(const ModintHash& lhs, const ModintHash& rhs) {
return ModintHash(lhs) -= rhs;
}
friend ModintHash operator*(const ModintHash& lhs, const ModintHash& rhs) {
return ModintHash(lhs) *= rhs;
}
bool operator==(const ModintHash &p) const { return x == p.x; }
bool operator!=(const ModintHash &p) const { return x != p.x; }
friend ostream &operator<<(ostream &os, const ModintHash &p) {
return os << p.x;
}
ModintHash pow(int64_t n) const {
ModintHash ret(1), mul(x);
while(n > 0) {
if(n & 1) ret *= mul;
mul *= mul;
n >>= 1;
}
return ret;
}
ul mul(ul a, ul b){
ul au = a >> 31;
ul ad = a & (1UL << 31) - 1;
ul bu = b >> 31;
ul bd = b & (1UL << 31) - 1;
ul mid = ad * bu + au * bd;
ul midu = mid >> 30;
ul midd = mid & (1UL << 30) - 1;
return calcmod(au * bu * 2 + midu + (midd << 31) + ad * bd);
}
ul calcmod(ul val){
val = (val & mod) + (val >> 61);
if(val >= mod) val -= mod;
return val;
}
};
void solve(){
ll res=0,buf=0;
bool judge = true;
ll n;cin>>n;
vector<string>a(n);
rep(i,0,n)cin>>a[i];
sort(ALL(a),[&](string &x,string &y){
if (x.size() != y.size()) return x.size() < y.size();
else return x < y;
});
using modint=ModintHash;
const int sz=2000010;
vector<vector<modint>>h(sz);
{
modint x=1,y=1;
ld flog=-log10(5)/2;
ld add=log10((1+sqrt(5))/2);
flog+=1+add+add;
ll cnt=0;
while(1){
flog+=add;
swap(x,y);
y+=x;
ll dig=floor(flog);
if(dig>=sz)break;
h[dig].push_back(y);
cnt++;
}
//OUT(cnt);
}
map<ul,ll>mp;
ll ret=0;
rep(i,0,n){
modint hash=0;
for(auto z:a[i]){
hash=hash*10+z-'0';
}
rep(j,-6,+6){
int d=(int)a[i].size()+j;
if(d<0||d>=sz)continue;
//OUT(a[i],hash,j,h[d]);
for(auto z:h[d]){
if(mp.count((z-hash).x))ret+=mp[(z-hash).x];
}
}
mp[hash.x]++;
}
cout<<ret<<endl;
}
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll res=0,buf=0;
bool judge = true;
int T = 1;
//cin>>T;
while(T--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 263ms
memory: 192716kb
input:
6 50 8 8 5 72 354224848179261915070
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 263ms
memory: 197924kb
input:
28 200878223506436882933619847964496455022155117513398820563747455993172799881403389571477889821109288771413214004090719097929400406252135763028179112130390003528046316900603668569910008417315162907579003880220844686222148696041857432602133894827753998572080650383305777912447151917272483538029469449...
output:
27
result:
ok 1 number(s): "27"
Test #3:
score: 0
Accepted
time: 355ms
memory: 198604kb
input:
5187 2640352926124261912741724778991366987330659389621881876017670644497364093930668042530271338851702874394631009332660937266680740235862107353443518003194307853104942996827176097428402408674756368623972812842571069642405111849826172879369776309763468485788964245903781380419155348915131587410703749...
output:
6073
result:
ok 1 number(s): "6073"
Test #4:
score: 0
Accepted
time: 288ms
memory: 199176kb
input:
200000 2 2 2 2 1 2 1 1 2 2 1 1 1 2 2 1 1 2 1 1 2 2 1 2 2 2 1 1 1 1 2 2 1 2 1 2 1 1 2 2 1 1 1 2 1 1 2 1 2 2 2 2 1 2 2 1 1 1 2 1 1 1 1 1 2 1 2 2 1 1 1 2 2 2 1 1 2 1 1 2 1 2 1 1 1 2 2 2 1 1 1 1 2 1 2 1 1 2 2 1 1 2 1 1 2 1 2 2 1 2 1 2 2 1 1 2 1 1 1 2 2 2 1 2 2 1 1 2 2 2 2 1 2 1 1 2 1 2 2 1 1 1 1 2 2 2 2...
output:
15003749259
result:
ok 1 number(s): "15003749259"
Test #5:
score: 0
Accepted
time: 2565ms
memory: 220824kb
input:
200000 944176313232170622314 2590599414036674999101 753315073608896000424 9299685298577430049245 9361800333778142620806 8988699166328904060999 9606920674025578304023 4203331868598952026136 5183047027116137697788 3968714342776915029801 8130984095583566992354 3206443643596048048798 6248561214283254355...
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 362ms
memory: 200608kb
input:
200000 9 10 3 5 9 3 3 9 8 5 1 2 7 8 4 6 2 3 3 9 5 5 4 9 7 5 8 2 6 10 9 7 2 2 1 10 10 6 10 7 4 7 9 7 2 2 10 4 5 8 2 2 5 8 9 5 3 9 2 1 7 6 8 8 6 3 8 2 2 9 10 2 9 7 1 9 1 4 5 9 2 7 10 1 8 7 4 8 1 10 6 4 4 9 1 9 7 3 6 5 6 9 5 3 6 6 4 4 6 1 8 6 10 3 10 2 1 4 1 4 8 2 9 1 4 8 10 8 2 2 3 6 4 7 10 10 9 4 7 6...
output:
4388485679
result:
ok 1 number(s): "4388485679"
Test #7:
score: 0
Accepted
time: 1629ms
memory: 220108kb
input:
200000 6828421000391895 1989111434563275 5896525738540342 7580233289915833 7220157112714422 6690072177484914 6664449707566084 8245839001391019 3008772159581769 8148007474169818 9400853099859484 6346860654847919 7403109176990407 2581313740335401 1273038733901266 9824983373567665 7206452987542085 7181...
output:
0
result:
ok 1 number(s): "0"
Test #8:
score: 0
Accepted
time: 1574ms
memory: 211568kb
input:
200000 163414517 35065810 104946881 686842158 509604537 114869915 194658958 55736013 211143419 526188788 18298540 311113507 727676120 517103071 25044427 38567543 386683792 246028194 750300322 4412101 865997254 674545866 775054146 977862574 699213474 347544102 740489922 632436817 297903184 435135324 ...
output:
59
result:
ok 1 number(s): "59"
Test #9:
score: 0
Accepted
time: 298ms
memory: 197436kb
input:
2 2088564186870382794642016448725374479500907752342156600368614861600912666885211013490310624029649329209019866849808883315545780833167257516031795949145341911463438482795792374909577113387320732207052482556858037878075154734524317145645776084240387870219160545328462016106959746495953786767421892196...
output:
1
result:
ok 1 number(s): "1"
Test #10:
score: 0
Accepted
time: 335ms
memory: 199660kb
input:
200000 6 1 3 9 1 8 9 9 2 6 8 6 2 3 9 2 2 7 4 7 8 8 4 8 2 7 8 9 2 9 2 4 4 1 10 6 2 10 2 6 8 3 10 3 6 10 10 10 2 4 6 4 7 8 1 2 1 1 4 10 5 5 4 10 3 8 5 6 1 7 8 1 2 6 3 8 9 9 5 1 9 5 6 10 9 4 1 7 8 3 10 4 3 2 7 7 9 4 5 6 6 7 8 10 6 6 3 6 8 1 7 4 2 6 10 8 4 2 7 4 2 5 4 9 10 5 2 3 2 4 8 7 9 7 7 8 2 5 7 2 ...
output:
4400854684
result:
ok 1 number(s): "4400854684"
Test #11:
score: 0
Accepted
time: 1577ms
memory: 211580kb
input:
200000 3118333850638 35270102833223 62994441325054 21050207685515 79452732606523 43405025574846 14676822470608 40589739145551 72610266245240 95906978427970 59399311725881 80286412880911 98171197939601 15555757959003 68766133429050 11529744877477 36884730947747 93994258932707 21245575958503 287958909...
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 1570ms
memory: 211628kb
input:
200000 1218982 621720 5848120 1753415 5889366 1747270 7735728 8089704 4279399 7927020 9269797 1332511 6334797 8964092 9525679 7325470 1527918 893049 8483303 1134021 8872739 532622 8977450 4503590 6512507 4903981 4892296 6522908 9237430 2297267 8063244 1546378 5054973 8702942 4392067 7868582 2029729 ...
output:
5695
result:
ok 1 number(s): "5695"
Test #13:
score: 0
Accepted
time: 293ms
memory: 198388kb
input:
2 2088564186870382794642016448725374479500907752342156600368614861600912666885211013490310624029649329209019866849808883315545780833167257516031795949145341911463438482795792374909577113387320732207052482556858037878075154734524317145645776084240387870219160545328462016106959746495953786767421892196...
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 272ms
memory: 197596kb
input:
7 1337338011484742791299410909385691591046809197321138600848517667449672944525104556519885455609314839827342014896149347803816156838828377155724440687227582622225528496005639283622580269360626125544811511998701746678193286138664078007880894120371020695543061391758951301196457121332483784041873539166...
output:
3
result:
ok 1 number(s): "3"
Test #15:
score: 0
Accepted
time: 319ms
memory: 198504kb
input:
274 36199225654659696764078634911736913237817300779619275513532816361663892134832409526194170532894366762053993742963156407869241123825595148459428450874407641181641292360313933002704706339921470798414371554709977458935038423965022899542511184991008496997550268720067992926078576871685757638601127765...
output:
273
result:
ok 1 number(s): "273"
Test #16:
score: 0
Accepted
time: 319ms
memory: 201876kb
input:
200000 4 3 8 5 8 9 4 10 1 3 7 1 3 10 1 10 10 7 8 2 8 9 6 6 1 2 2 6 6 7 10 7 1 3 6 2 8 4 3 3 8 9 4 3 9 6 4 1 6 3 3 5 4 2 3 9 3 3 6 7 6 1 5 5 2 10 2 1 5 9 6 7 3 2 9 1 3 8 8 3 10 7 5 5 6 9 10 8 1 5 6 2 1 8 5 4 1 7 9 9 2 8 9 8 5 7 4 9 3 3 4 7 9 1 8 1 5 9 8 8 7 10 1 4 2 3 7 8 6 1 10 10 8 9 4 10 4 5 5 6 9...
output:
4387062637
result:
ok 1 number(s): "4387062637"
Test #17:
score: 0
Accepted
time: 2085ms
memory: 220900kb
input:
200000 8244945625103564139 31587720380738895055 95764870267791202443 90342450187757930095 57990438361916446378 37041843791326956160 92044245094014254241 52147231507776742459 57440162490738372914 75951472709544205529 91095641579841704038 6354859395638708014 13171197741013485755 31875767906879519150 2...
output:
0
result:
ok 1 number(s): "0"
Test #18:
score: 0
Accepted
time: 276ms
memory: 192720kb
input:
10 6 8 6 6 7 6 3 3 2 6
output:
12
result:
ok 1 number(s): "12"
Test #19:
score: 0
Accepted
time: 295ms
memory: 198700kb
input:
2 2088564186870382794642016448725374479500907752342156600368614861600912666885211013490310624029649329209019866849808883315545780833167257516031795949145341911463438482795792374909577113387320732207052482556858037878075154734524317145645776084240387870219160545328462016106959746495953786767421892196...
output:
0
result:
ok 1 number(s): "0"
Test #20:
score: 0
Accepted
time: 1589ms
memory: 211676kb
input:
200000 51732486464 15203118134 55665354475 37097810807 44823788729 92577384010 20189320156 62707564695 81665154265 89603063623 48003727587 14457078372 37230540002 65288477498 52282695470 76070393338 26054936545 14171092817 61770329497 85319218123 57730830347 20295186479 9036398880 63607160628 825711...
output:
1
result:
ok 1 number(s): "1"
Test #21:
score: 0
Accepted
time: 240ms
memory: 192968kb
input:
1000 7 2 6 10 8 6 1 4 5 4 8 6 9 4 1 5 1 5 2 10 6 8 10 10 1 3 4 2 10 1 9 2 7 6 7 9 10 6 9 8 3 2 10 7 6 5 4 3 1 10 5 3 5 1 8 6 5 10 5 7 10 4 9 1 10 9 4 8 8 7 8 5 9 1 5 6 2 10 1 10 9 10 10 10 1 5 3 10 10 3 3 9 10 3 9 1 5 7 6 5 2 9 7 9 10 4 9 1 7 7 5 8 10 8 8 5 5 6 1 5 5 6 10 2 1 1 2 5 9 5 3 5 6 8 5 3 8...
output:
108128
result:
ok 1 number(s): "108128"
Test #22:
score: 0
Accepted
time: 1395ms
memory: 211896kb
input:
170297 36618903089511909212027904 295898671290484359833820549055 855922209609024693421257591054 104046893712788281969810034913 294974348216094859258128389147 898675289823399842963411259541 849917444544425201790051381287 554091687601993279655091754543 100543835187751461953816001432 324625661878684349...
output:
669637
result:
ok 1 number(s): "669637"
Test #23:
score: 0
Accepted
time: 326ms
memory: 197816kb
input:
9 1554055664340235444670436446744662342403532554270354440324316254234564540613440405260344004460144314614345467104554712624142524427154124266304046362254623626323466324132625200314136012323044624260020307414632254233433163613166424734133322715601644464634614352434441422431546266431240655123113002704...
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 272ms
memory: 192740kb
input:
30 173224810532175 17167616931584 361 605 17167680176960 956658780060 4052737359577 497497353099204 1548072001901 190392490708530 789347852872433 5 804010804445736 139520616464 43988911432793 4052739537276 514224 2178304 25273161431631 53314112869 17114366064696 20097096794 26821231255228 4944012745...
output:
29
result:
ok 1 number(s): "29"
Test #25:
score: 0
Accepted
time: 317ms
memory: 197988kb
input:
100 11549310117176145486225764017375125851223984720694884717797775426631366931455266419214045399503089615971818090352858567015012529938870819767662704737995190471260542479965705803468920094883954929878415301662741322840828368641397254767329039284292920968364857914289821588505056486091849012400101879...
output:
36
result:
ok 1 number(s): "36"
Test #26:
score: 0
Accepted
time: 1244ms
memory: 208548kb
input:
100223 94009034043768394308211497706411911232935573312371 90700235808140495519523074128684120917303691406421 72874906060637684247409916135076680433361225881761 80161826274205256086415063126094978143520789283159 98145703778166390989463238108464755254200147417281 70995217131009339533392756476859088949...
output:
0
result:
ok 1 number(s): "0"
Test #27:
score: 0
Accepted
time: 257ms
memory: 192700kb
input:
6 50 8 8 5 72 354224848179261915070
output:
4
result:
ok 1 number(s): "4"
Test #28:
score: 0
Accepted
time: 334ms
memory: 198340kb
input:
3161 7 14 130 1467 16244 105149 1241120 13689232 151890909 1684420994 10901848031 128682014414 1419326741506 15748353436059 101920677024935 1203048867903722 13269285156772499 147231358659594589 1632748057345119600 10567412357776757138 124734439986929988911 1375786096219966094366 15265241654400597567...
output:
3160
result:
ok 1 number(s): "3160"
Test #29:
score: 0
Accepted
time: 1579ms
memory: 211804kb
input:
200000 7930099016 7136448262 4599143849 4725192685 4685680672 739140078 7214691825 5031750793 4820916507 6017675339 485443032 2327198454 8808146518 7746012012 713572475 4706110510 3560774990 7482541413 8975601524 3896030632 3018545943 7048325939 2370597692 7867568189 6902951191 333917381 112842576 9...
output:
7
result:
ok 1 number(s): "7"
Test #30:
score: 0
Accepted
time: 261ms
memory: 194900kb
input:
60123 4 3 4 7 5 7 5 1 2 6 9 10 7 4 2 1 8 6 4 6 4 2 8 6 2 8 5 4 5 7 1 10 7 5 1 9 7 4 8 8 8 5 2 6 8 4 6 4 9 7 3 9 5 6 2 8 10 2 10 2 1 4 9 5 10 9 7 2 1 9 3 9 10 1 8 7 6 5 7 1 4 10 5 9 8 10 4 10 4 9 3 7 4 4 10 4 1 7 4 10 4 9 10 2 2 8 3 7 1 1 6 4 10 9 9 4 8 3 4 7 5 7 6 10 10 2 8 1 8 10 6 9 4 7 3 8 2 5 6 ...
output:
399686351
result:
ok 1 number(s): "399686351"
Test #31:
score: 0
Accepted
time: 286ms
memory: 192928kb
input:
20 11142320330634256153203413422244004724022423010341634226101444226235404243251 1510233372263004374041444256322353356243032432623343544033530634305504714430614564334410564323262245 3315442551434205740422347432544540327016564444656542244600440525402604662333366 53153452623340724302644316423336472713...
output:
0
result:
ok 1 number(s): "0"
Test #32:
score: 0
Accepted
time: 253ms
memory: 192928kb
input:
15 9227465 832040 701408733 2178309 267914296 433494437 165580141 1346269 5702887 3524578 102334155 24157817 14930352 63245986 39088169
output:
14
result:
ok 1 number(s): "14"
Test #33:
score: 0
Accepted
time: 278ms
memory: 194820kb
input:
10011 5327909559109070794570420158512927656597532686406620479564191583982981578330651724849734045529811497 9659152635523321620063357842120653540264735554377366787893904211734024058449827205523008852363337860 74727969709789190305111991663528709940303307406256850364862896747520682645094217166643105732...
output:
0
result:
ok 1 number(s): "0"
Test #34:
score: 0
Accepted
time: 335ms
memory: 198608kb
input:
10051 63063334260332707210045601560460743222655443603043556526226343270234640534370464564114515210165526527443654044521634373434642424304154632545440427364312534131536671541443033313334224226302334143144172200431314323334240461563243422303322351122343066463334623434 625665325411647124616714317265541...
output:
14
result:
ok 1 number(s): "14"
Test #35:
score: 0
Accepted
time: 1599ms
memory: 211660kb
input:
200000 3231427058997 5671035772108 505876205893 9869979702346 336233080766 4805367039084 270125613380 929924360332 6390838551951 1896341268898 3923051450784 397979630166 6527843499305 1937207519921 9355189911971 953387547771 5307619807657 6689006266290 517624961010 1532034993156 1921439567851 331239...
output:
0
result:
ok 1 number(s): "0"
Test #36:
score: 0
Accepted
time: 301ms
memory: 197652kb
input:
30 167491015938836604073444715975948275020752570351918554475806772549228015468626967999929915531115950274814727218152384400389926950026165552262394643249255747252904223055992443689134599380405599101636105379410012227917206510976118633243994494607279010051579617303878166798657109212106136099974387457...
output:
29
result:
ok 1 number(s): "29"
Test #37:
score: 0
Accepted
time: 1166ms
memory: 204448kb
input:
200000 31520 9835 67679 91981 37157 27950 36846 70635 13880 18818 52443 46788 38014 56271 48270 28452 36146 82523 60850 55346 16869 95814 89245 98640 40746 68625 53391 63023 4402 36521 95532 52344 24072 70060 11619 12227 98964 78211 95010 83216 22122 46697 31271 85556 57237 82689 92115 88247 9186 85...
output:
555586
result:
ok 1 number(s): "555586"
Test #38:
score: 0
Accepted
time: 289ms
memory: 198208kb
input:
2 7471143542670631923583760838674866685142093708045228091216520373087113961892117195149240140968159205634006625906479367372855893882103887377565868731323681755476477285090435798416695243644387513257156317699123267511524797133211810893688279220755514610253525742595752854587254548452737426517576583616...
output:
1
result:
ok 1 number(s): "1"
Test #39:
score: 0
Accepted
time: 289ms
memory: 195296kb
input:
80000 6 4 5 5 4 5 9 8 5 6 2 2 1 10 6 9 4 10 6 5 3 4 3 3 4 5 10 2 6 4 6 2 6 2 4 7 9 6 6 8 1 1 7 10 10 2 7 2 2 9 8 5 4 9 1 5 7 4 7 7 6 7 7 9 8 9 9 4 10 7 2 9 9 9 4 2 8 4 9 1 3 9 1 4 2 1 2 4 3 2 1 10 5 7 10 5 9 3 6 3 4 4 1 8 1 8 10 8 6 6 2 5 1 3 6 8 2 2 10 6 6 3 2 6 3 8 4 10 8 10 3 9 9 2 8 8 10 4 5 5 7...
output:
706251650
result:
ok 1 number(s): "706251650"
Test #40:
score: 0
Accepted
time: 316ms
memory: 201172kb
input:
200000 9 1 4 4 5 2 4 9 7 5 3 6 6 8 4 7 2 1 9 10 8 2 1 4 9 3 10 8 1 5 5 8 2 9 3 1 9 3 9 4 9 10 4 5 4 4 2 1 1 7 5 7 7 3 6 8 10 6 4 1 5 2 5 5 9 4 10 2 10 7 9 5 2 7 4 9 7 5 2 1 4 7 6 7 10 9 10 2 10 4 9 1 7 5 7 3 1 4 5 2 6 6 2 4 8 8 7 9 10 4 10 2 1 10 10 5 10 1 1 6 7 8 8 7 5 8 3 8 1 1 10 8 9 10 7 3 8 6 4...
output:
4417250451
result:
ok 1 number(s): "4417250451"
Test #41:
score: 0
Accepted
time: 756ms
memory: 205116kb
input:
84752 86009844223237105273313186367406421847273312848013100091343 340516459610995530579473198046278412250343444815876655725270 62236463822700922600990709332929319814536375509143833251557 5611500219672931601067284378715174151735452175901717138530 64201778346042476353565735947990316834224189505881 609...
output:
420579
result:
ok 1 number(s): "420579"
Test #42:
score: 0
Accepted
time: 1895ms
memory: 220824kb
input:
200000 7127173784651987052 4249291679502906721 9703708230592019478 4404701921242244700 2344941043578422215 3091914365064271594 9867051863259427168 9880844309023770200 7211977710785226267 1694381065563438860 201683809955321192 4085536489000602058 7553409623903962290 4033981640350364868 54455660173955...
output:
0
result:
ok 1 number(s): "0"
Test #43:
score: 0
Accepted
time: 348ms
memory: 201776kb
input:
200000 9 9 2 10 3 4 3 9 7 7 8 5 9 9 7 5 8 5 7 1 5 6 3 2 7 5 7 7 2 9 8 6 2 1 8 1 3 4 10 2 3 4 4 7 4 10 8 6 1 5 3 3 3 5 5 8 6 9 3 6 5 4 2 8 10 9 1 5 1 4 8 9 4 3 4 9 10 3 6 2 10 3 3 6 6 7 4 9 5 2 1 8 8 7 308061521170126 7 4 6 1 9 3 9 9 3 1 10 8 7 2 9 10 6 2 6 10 8 5 1 5 1 7 9 5 3 6 1 4 2 6 2 8 5 3 1 6 ...
output:
4397248166
result:
ok 1 number(s): "4397248166"
Test #44:
score: 0
Accepted
time: 299ms
memory: 194548kb
input:
156 18459619692692557705784877669569448552986613407875981372394172107449477143544507182981317111359110933094916231296859516709399078435198069511763391151449973008095601542066128297192521457018669738382503324519683244087838172215626103362576668917140635977557324975206273718561053735845026938082217687...
output:
155
result:
ok 1 number(s): "155"
Test #45:
score: 0
Accepted
time: 309ms
memory: 201624kb
input:
200000 1 10 4 3 10 1 9 5 9 4 9 1 6 6 1 7 2 1 10 3 2 3 4 7 7 3 9 9 10 3 4 10 10 7 7 2 5 10 9 6 8 1 4 4 5 8 8 6 5 10 10 9 10 9 5 1 7 6 5 10 2 4 1 7 10 6 7 8 2 3 3 10 1 7 6 10 2 7 1 9 6 10 8 4 7 3 9 1 6 9 2 3 4 8 7 8 3 6 4 10 2 2 1 9 7 2 2 8 2 1 2 10 5 4 10 9 9 7 9 4 3 10 9 1 2 9 9 2 7 1 6 7 10 6 5 9 6...
output:
4407433502
result:
ok 1 number(s): "4407433502"
Test #46:
score: 0
Accepted
time: 595ms
memory: 202496kb
input:
51002 376123568879569384290612536925367837315702704676220875375604948366932308891841579226324979782110 28623980260058260408921525210046136035459718869538444006842678034295486291710095655185249062457587 21690449377523978494384257361181223226054780834691728496618681724478608654823982012150023238151530...
output:
81486
result:
ok 1 number(s): "81486"
Test #47:
score: 0
Accepted
time: 1684ms
memory: 220908kb
input:
200000 478606336755874083 603529542039676573 240066379679942455 20635508638460497 945472883349378253 395868479387568634 865948317871000880 136079313625171264 764680881358360622 195117422398549932 143437863196805305 907507515211279442 723479709912499971 671617918537158715 439287855279754360 202716825...
output:
0
result:
ok 1 number(s): "0"
Test #48:
score: 0
Accepted
time: 325ms
memory: 197724kb
input:
19 114661534643152246311744033174352334643324503262044605562234546544736534426056314403004340112331342520053464440541422433562206354434233744572233143044234304056542423441346156352252422334142225474302135741207345424432300443162054415443457163346015613444533444074633135446264371437171714063445404655...
output:
0
result:
ok 1 number(s): "0"
Test #49:
score: 0
Accepted
time: 1640ms
memory: 211632kb
input:
200000 497856383454 506720870857 899176487457 12145678485 541966940864 272264831455 178825186059 7038707436 481602633783 181735126537 559631305498 335603421321 761406732158 369431205173 615437274239 923671138603 543441698085 733638673698 858564208935 726626729204 880133143653 415511404815 9211110013...
output:
1
result:
ok 1 number(s): "1"
Test #50:
score: 0
Accepted
time: 321ms
memory: 197392kb
input:
5 2011068126132617886949194530211424837999019187297342375967282498616949073685995418305378991927261698758022155241855161670361072821581948280878066032787805987660111096801265330758292151243775781982581126595354464038574958455139626266660161003165949122588221798586300395825356961553839057885407409810...
output:
4
result:
ok 1 number(s): "4"
Test #51:
score: 0
Accepted
time: 340ms
memory: 199184kb
input:
200000 91 67 28 7 87 97 87 80 71 5 67 1 98 85 60 62 99 46 9 81 10 7 15 91 74 69 11 34 85 47 56 48 29 16 25 5 46 9 73 24 84 10 97 22 78 18 29 70 92 98 61 43 54 66 55 15 77 20 25 16 84 11 93 65 61 91 18 59 31 93 53 33 34 59 90 41 21 27 82 49 33 64 96 18 46 71 94 95 30 62 47 9 62 79 29 28 65 67 32 48 9...
output:
591328867
result:
ok 1 number(s): "591328867"
Extra Test:
score: 0
Extra Test Passed