Submission #752767

# Submission time Handle Problem Language Result Execution time Memory
752767 2023-06-03T19:49:34 Z lychees Hard route (IZhO17_road) C++17
100 / 100
539 ms 112716 KB
/*
    Last Weapon is my own algorithms library for competitive programming, it is a fork from ACL with some alternative algorithms and additional features. Use it at your own risk.
    Repo: https://github.com/lychees/last-weapon
    Blog: https://www.shuizilong.com/house
*/
#pragma comment(linker, "/STACK:36777216")
#define LOCAL
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>


using namespace std;

#define REP(i, n) for (int i=0;i<n;++i)
#define FOR(i, a, b) for (int i=a;i<b;++i)
#define DWN(i, b, a) for (int i=b-1;i>=a;--i)
#define REP_1(i, n) for (int i=1;i<=n;++i)
#define FOR_1(i, a, b) for (int i=a;i<=b;++i)
#define DWN_1(i, b, a) for (int i=b;i>=a;--i)

#define ECH(it, A) for (__typeof((A).begin()) it=(A).begin(); it != (A).end(); ++it)
#define rECH(it, A) for (__typeof((A).rbegin()) it=(A).rbegin(); it != (A).rend(); ++it)
#define REP_S(i, str) for (char*i=str;*i;++i)
#define REP_L(i, hd, suc) for (int i=hd;i;i=suc[i])
#define REP_G(i, u) REP_L(i,hd[u],suc)
#define REP_SS(x, s) for (int x=s;x;x=(x-1)&s)
#define DO(n) for ( int ____n = n; ____n-->0; )

#define ALL(A) A.begin(), A.end()
#define LLA(A) A.rbegin(), A.rend()
#define CPY(A, B) memcpy(A, B, sizeof(A))
#define INS(A, P, B) A.insert(A.begin() + P, B)
#define ERS(A, P) A.erase(A.begin() + P)
#define LBD(A, x) (lower_bound(ALL(A), x) - A.begin())
#define UBD(A, x) (upper_bound(ALL(A), x) - A.begin())
#define CTN(T, x) (T.find(x) != T.end())
#define SZ(A) int((A).size())
#define PB push_back
#define MP(A, B) make_pair(A, B)
#define PTT pair<T, T>
#define Ts *this
#define rTs return Ts
#define fi first
#define se second
#define re real()
#define im imag()

#define Rush for(int ____T=RD(); ____T--;)
#define Display(A, n, m) {                      \
  REP(i, n){		                            \
        REP(j, m-1) cout << A[i][j] << " ";     \
        cout << A[i][m-1] << endl;		        \
	}						                    \
}
#define Display_1(A, n, m) {                    \
	REP_1(i, n){		                        \
        REP_1(j, m-1) cout << A[i][j] << " ";   \
        cout << A[i][m] << endl;		        \
	}						                    \
}

typedef long long LL;
typedef double DB;
typedef unsigned uint;
typedef unsigned long long uLL;

typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<string> VS;
typedef vector<LL> VL;
typedef vector<DB> VF;
typedef set<int> SI;
typedef set<string> SS;
typedef map<int, int> MII;
typedef map<string, int> MSI;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef vector<VII> VVII;

template<class T> inline T& RD(T &);
template<class T> inline void OT(const T &);
inline LL RD(){LL x; return RD(x);}
inline DB& RF(DB &);
inline DB RF(){DB x; return RF(x);}
inline char* RS(char *s);
inline char& RC(char &c);
inline char RC();
inline char& RC(char &c){scanf(" %c", &c); return c;}
inline char RC(){char c; return RC(c);}

template<class T0, class T1> inline T0& RD(T0 &x0, T1 &x1){RD(x0), RD(x1); return x0;}
template<class T0, class T1, class T2> inline T0& RD(T0 &x0, T1 &x1, T2 &x2){RD(x0), RD(x1), RD(x2); return x0;}
template<class T0, class T1, class T2, class T3> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3){RD(x0), RD(x1), RD(x2), RD(x3); return x0;}
template<class T0, class T1, class T2, class T3, class T4> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4); return x0;}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5); return x0;}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline T0& RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5, T6 &x6){RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5), RD(x6); return x0;}
template<class T0, class T1> inline void OT(const T0 &x0, const T1 &x1){OT(x0), OT(x1);}
template<class T0, class T1, class T2> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2){OT(x0), OT(x1), OT(x2);}
template<class T0, class T1, class T2, class T3> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3){OT(x0), OT(x1), OT(x2), OT(x3);}
template<class T0, class T1, class T2, class T3, class T4> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4, const T5 &x5){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void OT(const T0 &x0, const T1 &x1, const T2 &x2, const T3 &x3, const T4 &x4, const T5 &x5, const T6 &x6){OT(x0), OT(x1), OT(x2), OT(x3), OT(x4), OT(x5), OT(x6);}
inline char& RC(char &a, char &b){RC(a), RC(b); return a;}
inline char& RC(char &a, char &b, char &c){RC(a), RC(b), RC(c); return a;}
inline char& RC(char &a, char &b, char &c, char &d){RC(a), RC(b), RC(c), RC(d); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e){RC(a), RC(b), RC(c), RC(d), RC(e); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e, char &f){RC(a), RC(b), RC(c), RC(d), RC(e), RC(f); return a;}
inline char& RC(char &a, char &b, char &c, char &d, char &e, char &f, char &g){RC(a), RC(b), RC(c), RC(d), RC(e), RC(f), RC(g); return a;}
inline DB& RF(DB &a, DB &b){RF(a), RF(b); return a;}
inline DB& RF(DB &a, DB &b, DB &c){RF(a), RF(b), RF(c); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d){RF(a), RF(b), RF(c), RF(d); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e){RF(a), RF(b), RF(c), RF(d), RF(e); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e, DB &f){RF(a), RF(b), RF(c), RF(d), RF(e), RF(f); return a;}
inline DB& RF(DB &a, DB &b, DB &c, DB &d, DB &e, DB &f, DB &g){RF(a), RF(b), RF(c), RF(d), RF(e), RF(f), RF(g); return a;}
inline void RS(char *s1, char *s2){RS(s1), RS(s2);}
inline void RS(char *s1, char *s2, char *s3){RS(s1), RS(s2), RS(s3);}

template<class T> inline void RST(T &A){memset(A, 0, sizeof(A));}
template<class T> inline void FLC(T &A, int x){memset(A, x, sizeof(A));}
template<class T> inline void CLR(T &A){A.clear();}

template<class T0, class T1> inline void RST(T0 &A0, T1 &A1){RST(A0), RST(A1);}
template<class T0, class T1, class T2> inline void RST(T0 &A0, T1 &A1, T2 &A2){RST(A0), RST(A1), RST(A2);}
template<class T0, class T1, class T2, class T3> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3){RST(A0), RST(A1), RST(A2), RST(A3);}
template<class T0, class T1, class T2, class T3, class T4> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void RST(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){RST(A0), RST(A1), RST(A2), RST(A3), RST(A4), RST(A5), RST(A6);}
template<class T0, class T1> inline void FLC(T0 &A0, T1 &A1, int x){FLC(A0, x), FLC(A1, x);}
template<class T0, class T1, class T2> inline void FLC(T0 &A0, T1 &A1, T2 &A2, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x);}
template<class T0, class T1, class T2, class T3> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x);}
template<class T0, class T1, class T2, class T3, class T4> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x), FLC(A5, x);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void FLC(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6, int x){FLC(A0, x), FLC(A1, x), FLC(A2, x), FLC(A3, x), FLC(A4, x), FLC(A5, x), FLC(A6, x);}
template<class T> inline void CLR(priority_queue<T> &Q){while (!Q.empty()) Q.pop();}
template<class T> inline void CLR(stack<T> &S){while (!S.empty()) S.pop();}
template<class T> inline void CLR(queue<T> &Q){while (!Q.empty()) Q.pop();}

template<class T0, class T1> inline void CLR(T0 &A0, T1 &A1){CLR(A0), CLR(A1);}
template<class T0, class T1, class T2> inline void CLR(T0 &A0, T1 &A1, T2 &A2){CLR(A0), CLR(A1), CLR(A2);}
template<class T0, class T1, class T2, class T3> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3){CLR(A0), CLR(A1), CLR(A2), CLR(A3);}
template<class T0, class T1, class T2, class T3, class T4> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4);}
template<class T0, class T1, class T2, class T3, class T4, class T5> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5);}
template<class T0, class T1, class T2, class T3, class T4, class T5, class T6> inline void CLR(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6){CLR(A0), CLR(A1), CLR(A2), CLR(A3), CLR(A4), CLR(A5), CLR(A6);}
template<class T> inline void CLR(T &A, int n){REP(i, n) CLR(A[i]);}

template<class T> inline bool EPT(T &a){return a.empty();}
template<class T> inline T& SRT(T &A){sort(ALL(A)); return A;}
template<class T, class C> inline T& SRT(T &A, C cmp){sort(ALL(A), cmp); return A;}
template<class T> inline T& RVS(T &A){reverse(ALL(A)); return A;}
template<class T> inline T& UNQQ(T &A){A.resize(unique(ALL(A))-A.begin());return A;}
template<class T> inline T& UNQ(T &A){SRT(A);return UNQQ(A);}
template<class T, class C> inline T& UNQ(T &A, C cmp){SRT(A, cmp);return UNQQ(A);}



/** Constant List .. **/ //{

int MOD = int(1e9) + 7;
const int INF = 0x3f3f3f3f;
const LL INFF = 0x3f3f3f3f3f3f3f3fLL;
const DB EPS = 1e-9;
const DB OO = 1e20;
const DB PI = acos(-1.0); //M_PI;

const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, 1, -1};


/** Add On .. **/ //{

template<class T> inline bool checkMin(T &a,const T b){return b < a ? a = b, 1 : 0;}
template<class T> inline bool checkMax(T &a,const T b){return a < b ? a = b, 1 : 0;}
template <class T, class C> inline bool checkUpd(T& a, const T b, C c){return c(b,a) ? a = b, 1 : 0;}
template<class T> inline T min(T a, T b, T c){return min(min(a, b), c);}
template<class T> inline T max(T a, T b, T c){return max(max(a, b), c);}
template<class T> inline T min(T a, T b, T c, T d){return min(min(a, b), min(c, d));}
template<class T> inline T max(T a, T b, T c, T d){return max(max(a, b), max(c, d));}
template<class T> inline T sqr(T a){return a*a;}
template<class T> inline T cub(T a){return a*a*a;}
template<class T> inline T ceil(T x, T y){return (x - 1) / y + 1;}
template<class T> T abs(T x){return x>0?x:-x;}
inline int sgn(DB x){return x < -EPS ? -1 : x > EPS;}
inline int sgn(DB x, DB y){return sgn(x - y);}

template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& a) {
    in >> a.fi >> a.se;
    return in;
}
template<typename T, size_t N> istream& operator>>(istream& in, array<T, N>& a) {
    REP(i, N) cin >> a[i];
    return in;
}
template<typename T> istream& operator>>(istream& in, vector<T>& a) {
    REP(i, SZ(a)) in >> a[i];
    return in;
}
template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2>& a) {
    out << a.fi << " " << a.se;
    return out;
}
template<typename T, size_t N> ostream& operator<<(ostream& out, array<T, N>& a) {
    REP(i, N-1) out << a[i] << " "; if (N) out << a.back();
    return out;
}
template<typename T> ostream& operator<<(ostream& out, vector<T>& a) {
    REP(i, SZ(a)-1) out << a[i] << " "; if (SZ(a)) out << a.back();
    return out;
}





/** I/O Accelerator Interface .. **/ //{
#define g (c=getchar())
#define d isdigit(g)
#define p x=x*10+c-'0'
#define n x=x*10+'0'-c
#define pp l/=10,p
#define nn l/=10,n
template<class T> inline T& RD(T &x){
    char c;while(g,c!='-'&&!isdigit(c));
    if (c=='-'){x='0'-g;while(d)n;}
    else{x=c-'0';while(d)p;}
    return x;
}
inline DB& RF(DB &x){
    char c;while(g,c!='-'&&c!='.'&&!isdigit(c));
    if(c=='-')if(g=='.'){x=0;DB l=1;while(d)nn;x*=l;}
        else{x='0'-c;while(d)n;if(c=='.'){DB l=1;while(d)nn;x*=l;}}
    else if(c=='.'){x=0;DB l=1;while(d)pp;x*=l;}
        else{x=c-'0';while(d)p;if(c=='.'){DB l=1;while(d)pp;x*=l;}}
    return x;
}
#undef nn
#undef pp
#undef n
#undef p
#undef d
#undef g
inline char* RS(char *s){
    scanf("%s", s);
    return s;
}

LL last_ans; int Case; template<class T> inline void OT(const T &x){
    cout << x << endl;
}
namespace lastweapon {}
using namespace lastweapon;

const int N = int(5e5) + 9;

struct rec : public pair<LL, LL> {
    rec(LL a = 0, LL b = 0){
        fi = a, se = b;
    }
    //operator <(const rec&r) {return fi < r.fi;}
    //operator ==(const rec&r) {return fi == r.fi;}
    rec& operator +=(const rec&r){
        if (fi == r.fi) se += r.se;
        else checkMax(*this, r);
        rTs;
    }
};

rec d[N], z = {0, 1};
VI adj[N]; int n;

void upd(rec d[], rec v) {
    if (v > d[0]) d[2] = d[1], d[1] = d[0], d[0] = v;
    else if (v > d[1]) d[2] = d[1], d[1] = v;
    else if (v > d[2]) d[2] = v;
}

void dfs1(int u = 1, int p = 0) {
    d[u] = {0, 1};
    for (auto v: adj[u]) if (v != p) {
        dfs1(v, u);
        d[u] += d[v];
    }
    d[u].fi += 1;
    //cout << u << " " << d[u].fi << " " <<d[u].se << endl;
}

void dfs2(int u = 1, int p = 0, rec up = {0, 1}) {

    //cout << u << " " << up.fi << " " << up.se << endl;
    rec path[3];

    upd(path, up);
    for (auto v: adj[u]) if (v != p) {
        upd(path, d[v]);
    }

    /*REP(i, 3) cout << path[i].fi << " " << path[i].se << " | ";
    cout << up.fi << " " << up.se << endl;
    cout << endl;*/

    if (path[2].fi) {
        LL best = path[0].fi * (path[1].fi + path[2].fi);
        if (best >= z.fi) {
            LL ways, ways2 = up.fi == path[2].fi ? up.se : 0;
            for (auto v: adj[u]) if (v != p) if (d[v].fi == path[2].fi) ways2 += d[v].se;

            if (path[1].fi == path[2].fi) {
                ways = sqr(ways2);
                if (up.fi == path[2].fi) ways -= sqr(up.se);
                for (auto v: adj[u]) if (v != p) if (d[v].fi == path[2].fi) ways -= sqr(d[v].se);
                ways /= 2;
            } else {
                ways = ((path[0].fi == path[1].fi ? path[0].se : 0) + path[1].se) * ways2;
            }
            z += rec(best, ways);
        }
    }

    LL ways0 = 0, ways1 = 0;
    if (up.fi == path[0].fi) ways0 += up.se;
    else if (up.fi == path[1].fi) ways1 += up.se;
    for (auto v: adj[u]) if (v != p) {
        if (d[v].fi == path[0].fi) ways0 += d[v].se;
        else if (d[v].fi == path[1].fi) ways1 += d[v].se;
    }

    for (auto v: adj[u]) if (v != p) {
        LL a = path[0].fi+1, b = ways0;
        if (d[v].fi == path[0].fi) {
            if (d[v].se == ways0) a = path[1].fi+1, b = ways1;
            else b = ways0 - d[v].se;
        }
        dfs2(v, u, {a, b});
    }
}

int main() {

    DO(RD(n)-1) {
        int x, y; RD(x, y);
        adj[x].PB(y);
        adj[y].PB(x);
    }

    dfs1(); dfs2();
    cout << z.fi << " " << z.se << endl;
}

Compilation message

road.cpp:6: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    6 | #pragma comment(linker, "/STACK:36777216")
      | 
road.cpp: In function 'std::ostream& operator<<(std::ostream&, std::array<_Tp, _Nm>&)':
road.cpp:34:19: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   34 | #define REP(i, n) for (int i=0;i<n;++i)
      |                   ^~~
road.cpp:224:5: note: in expansion of macro 'REP'
  224 |     REP(i, N-1) out << a[i] << " "; if (N) out << a.back();
      |     ^~~
road.cpp:224:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  224 |     REP(i, N-1) out << a[i] << " "; if (N) out << a.back();
      |                                     ^~
road.cpp: In function 'std::ostream& operator<<(std::ostream&, std::vector<_Tp>&)':
road.cpp:34:19: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   34 | #define REP(i, n) for (int i=0;i<n;++i)
      |                   ^~~
road.cpp:228:5: note: in expansion of macro 'REP'
  228 |     REP(i, SZ(a)-1) out << a[i] << " "; if (SZ(a)) out << a.back();
      |     ^~~
road.cpp:228:41: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  228 |     REP(i, SZ(a)-1) out << a[i] << " "; if (SZ(a)) out << a.back();
      |                                         ^~
# Verdict Execution time Memory Grader output
1 Correct 13 ms 19872 KB Output is correct
2 Correct 11 ms 19864 KB Output is correct
3 Correct 10 ms 19868 KB Output is correct
4 Correct 10 ms 19796 KB Output is correct
5 Correct 10 ms 19844 KB Output is correct
6 Correct 11 ms 19868 KB Output is correct
7 Correct 10 ms 19864 KB Output is correct
8 Correct 10 ms 19876 KB Output is correct
9 Correct 10 ms 19796 KB Output is correct
10 Correct 11 ms 19856 KB Output is correct
11 Correct 10 ms 19868 KB Output is correct
12 Correct 10 ms 19796 KB Output is correct
13 Correct 11 ms 19808 KB Output is correct
14 Correct 13 ms 19812 KB Output is correct
15 Correct 11 ms 19872 KB Output is correct
16 Correct 10 ms 19796 KB Output is correct
17 Correct 10 ms 19796 KB Output is correct
18 Correct 10 ms 19872 KB Output is correct
19 Correct 10 ms 19872 KB Output is correct
20 Correct 10 ms 19876 KB Output is correct
21 Correct 10 ms 19796 KB Output is correct
22 Correct 10 ms 19796 KB Output is correct
23 Correct 10 ms 19796 KB Output is correct
24 Correct 10 ms 19796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 19872 KB Output is correct
2 Correct 11 ms 19864 KB Output is correct
3 Correct 10 ms 19868 KB Output is correct
4 Correct 10 ms 19796 KB Output is correct
5 Correct 10 ms 19844 KB Output is correct
6 Correct 11 ms 19868 KB Output is correct
7 Correct 10 ms 19864 KB Output is correct
8 Correct 10 ms 19876 KB Output is correct
9 Correct 10 ms 19796 KB Output is correct
10 Correct 11 ms 19856 KB Output is correct
11 Correct 10 ms 19868 KB Output is correct
12 Correct 10 ms 19796 KB Output is correct
13 Correct 11 ms 19808 KB Output is correct
14 Correct 13 ms 19812 KB Output is correct
15 Correct 11 ms 19872 KB Output is correct
16 Correct 10 ms 19796 KB Output is correct
17 Correct 10 ms 19796 KB Output is correct
18 Correct 10 ms 19872 KB Output is correct
19 Correct 10 ms 19872 KB Output is correct
20 Correct 10 ms 19876 KB Output is correct
21 Correct 10 ms 19796 KB Output is correct
22 Correct 10 ms 19796 KB Output is correct
23 Correct 10 ms 19796 KB Output is correct
24 Correct 10 ms 19796 KB Output is correct
25 Correct 13 ms 20180 KB Output is correct
26 Correct 11 ms 20308 KB Output is correct
27 Correct 11 ms 20332 KB Output is correct
28 Correct 11 ms 20392 KB Output is correct
29 Correct 11 ms 20200 KB Output is correct
30 Correct 11 ms 20432 KB Output is correct
31 Correct 11 ms 20268 KB Output is correct
32 Correct 11 ms 20272 KB Output is correct
33 Correct 11 ms 20308 KB Output is correct
34 Correct 12 ms 20336 KB Output is correct
35 Correct 13 ms 20392 KB Output is correct
36 Correct 11 ms 20284 KB Output is correct
37 Correct 11 ms 20436 KB Output is correct
38 Correct 12 ms 20728 KB Output is correct
39 Correct 10 ms 20180 KB Output is correct
40 Correct 14 ms 20112 KB Output is correct
41 Correct 11 ms 20052 KB Output is correct
42 Correct 14 ms 20052 KB Output is correct
43 Correct 12 ms 20052 KB Output is correct
44 Correct 12 ms 20008 KB Output is correct
45 Correct 11 ms 19996 KB Output is correct
46 Correct 11 ms 20008 KB Output is correct
47 Correct 11 ms 20052 KB Output is correct
48 Correct 11 ms 20052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 19872 KB Output is correct
2 Correct 11 ms 19864 KB Output is correct
3 Correct 10 ms 19868 KB Output is correct
4 Correct 10 ms 19796 KB Output is correct
5 Correct 10 ms 19844 KB Output is correct
6 Correct 11 ms 19868 KB Output is correct
7 Correct 10 ms 19864 KB Output is correct
8 Correct 10 ms 19876 KB Output is correct
9 Correct 10 ms 19796 KB Output is correct
10 Correct 11 ms 19856 KB Output is correct
11 Correct 10 ms 19868 KB Output is correct
12 Correct 10 ms 19796 KB Output is correct
13 Correct 11 ms 19808 KB Output is correct
14 Correct 13 ms 19812 KB Output is correct
15 Correct 11 ms 19872 KB Output is correct
16 Correct 10 ms 19796 KB Output is correct
17 Correct 10 ms 19796 KB Output is correct
18 Correct 10 ms 19872 KB Output is correct
19 Correct 10 ms 19872 KB Output is correct
20 Correct 10 ms 19876 KB Output is correct
21 Correct 10 ms 19796 KB Output is correct
22 Correct 10 ms 19796 KB Output is correct
23 Correct 10 ms 19796 KB Output is correct
24 Correct 10 ms 19796 KB Output is correct
25 Correct 13 ms 20180 KB Output is correct
26 Correct 11 ms 20308 KB Output is correct
27 Correct 11 ms 20332 KB Output is correct
28 Correct 11 ms 20392 KB Output is correct
29 Correct 11 ms 20200 KB Output is correct
30 Correct 11 ms 20432 KB Output is correct
31 Correct 11 ms 20268 KB Output is correct
32 Correct 11 ms 20272 KB Output is correct
33 Correct 11 ms 20308 KB Output is correct
34 Correct 12 ms 20336 KB Output is correct
35 Correct 13 ms 20392 KB Output is correct
36 Correct 11 ms 20284 KB Output is correct
37 Correct 11 ms 20436 KB Output is correct
38 Correct 12 ms 20728 KB Output is correct
39 Correct 10 ms 20180 KB Output is correct
40 Correct 14 ms 20112 KB Output is correct
41 Correct 11 ms 20052 KB Output is correct
42 Correct 14 ms 20052 KB Output is correct
43 Correct 12 ms 20052 KB Output is correct
44 Correct 12 ms 20008 KB Output is correct
45 Correct 11 ms 19996 KB Output is correct
46 Correct 11 ms 20008 KB Output is correct
47 Correct 11 ms 20052 KB Output is correct
48 Correct 11 ms 20052 KB Output is correct
49 Correct 342 ms 68956 KB Output is correct
50 Correct 351 ms 73832 KB Output is correct
51 Correct 340 ms 78120 KB Output is correct
52 Correct 359 ms 63148 KB Output is correct
53 Correct 279 ms 71348 KB Output is correct
54 Correct 290 ms 75776 KB Output is correct
55 Correct 291 ms 64536 KB Output is correct
56 Correct 298 ms 69308 KB Output is correct
57 Correct 300 ms 81044 KB Output is correct
58 Correct 340 ms 75456 KB Output is correct
59 Correct 312 ms 75448 KB Output is correct
60 Correct 324 ms 72852 KB Output is correct
61 Correct 509 ms 112716 KB Output is correct
62 Correct 507 ms 99872 KB Output is correct
63 Correct 539 ms 62716 KB Output is correct
64 Correct 506 ms 53876 KB Output is correct
65 Correct 498 ms 48252 KB Output is correct
66 Correct 458 ms 45316 KB Output is correct
67 Correct 468 ms 43692 KB Output is correct
68 Correct 477 ms 43084 KB Output is correct
69 Correct 489 ms 42820 KB Output is correct
70 Correct 467 ms 42748 KB Output is correct
71 Correct 475 ms 42684 KB Output is correct
72 Correct 465 ms 42700 KB Output is correct
73 Correct 497 ms 42584 KB Output is correct
74 Correct 468 ms 42704 KB Output is correct
75 Correct 479 ms 42948 KB Output is correct
76 Correct 452 ms 43052 KB Output is correct
77 Correct 345 ms 43448 KB Output is correct
78 Correct 222 ms 44624 KB Output is correct