Submission #528124

# Submission time Handle Problem Language Result Execution time Memory
528124 2022-02-19T10:37:13 Z ainta From Hacks to Snitches (BOI21_watchmen) C++17
50 / 100
6000 ms 100520 KB
#include <bits/stdc++.h>
using namespace std;
 
 
namespace Rec{
    template<class Fun>
    class y_combinator_result {
        Fun fun_;
    public:
        template<class T>
        explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}
 
        template<class ...Args>
        decltype(auto) operator()(Args &&...args) {
            return fun_(std::ref(*this), std::forward<Args>(args)...);
        }
    };
 
    template<class Fun>
    decltype(auto) y_combinator(Fun &&fun) {
        return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
    }
}
 
 
//fast IO by yosupo
struct Scanner {
    FILE* fp = nullptr;
    char line[(1 << 15) + 1];
    size_t st = 0, ed = 0;
    void reread() {
        memmove(line, line + st, ed - st);
        ed -= st;
        st = 0;
        ed += fread(line + ed, 1, (1 << 15) - ed, fp);
        line[ed] = '\0';
    }
    bool succ() {
        while (true) {
            if (st == ed) {
                reread();
                if (st == ed) return false;
            }
            while (st != ed && isspace(line[st])) st++;
            if (st != ed) break;
        }
        if (ed - st <= 50) reread();
        return true;
    }
    template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
    bool read_single(T& ref) {
        if (!succ()) return false;
        while (true) {
            size_t sz = 0;
            while (st + sz < ed && !isspace(line[st + sz])) sz++;
            ref.append(line + st, sz);
            st += sz;
            if (!sz || st != ed) break;
            reread();            
        }
        return true;
    }
    template <class T, enable_if_t<is_integral<T>::value, int> = 0>
    bool read_single(T& ref) {
        if (!succ()) return false;
        bool neg = false;
        if (line[st] == '-') {
            neg = true;
            st++;
        }
        ref = T(0);
        while (isdigit(line[st])) {
            ref = 10 * ref + (line[st++] - '0');
        }
        if (neg) ref = -ref;
        return true;
    }
    template <class T> bool read_single(vector<T>& ref) {
        for (auto& d : ref) {
            if (!read_single(d)) return false;
        }
        return true;
    }
    void read() {}
    template <class H, class... T> void read(H& h, T&... t) {
        bool f = read_single(h);
        assert(f);
        read(t...);
    }
    Scanner(FILE* _fp) : fp(_fp) {}
};
 
struct Printer {
  public:
    template <bool F = false> void write() {}
    template <bool F = false, class H, class... T>
    void write(const H& h, const T&... t) {
        if (F) write_single(' ');
        write_single(h);
        write<true>(t...);
    }
    template <class... T> void writeln(const T&... t) {
        write(t...);
        write_single('\n');
    }
 
    Printer(FILE* _fp) : fp(_fp) {}
    ~Printer() { flush(); }
 
  private:
    static constexpr size_t SIZE = 1 << 15;
    FILE* fp;
    char line[SIZE], small[50];
    size_t pos = 0;
    void flush() {
        fwrite(line, 1, pos, fp);
        pos = 0;
    }
    void write_single(const char& val) {
        if (pos == SIZE) flush();
        line[pos++] = val;
    }
    template <class T, enable_if_t<is_integral<T>::value, int> = 0>
    void write_single(T val) {
        if (pos > (1 << 15) - 50) flush();
        if (val == 0) {
            write_single('0');
            return;
        }
        if (val < 0) {
            write_single('-');
            val = -val;  // todo min
        }
        size_t len = 0;
        while (val) {
            small[len++] = char('0' + (val % 10));
            val /= 10;
        }
        for (size_t i = 0; i < len; i++) {
            line[pos + i] = small[len - 1 - i];
        }
        pos += len;
    }
    void write_single(const string& s) {
        for (char c : s) write_single(c);
    }
    void write_single(const char* s) {
        size_t len = strlen(s);
        for (size_t i = 0; i < len; i++) write_single(s[i]);
    }
    template <class T> void write_single(const vector<T>& val) {
        auto n = val.size();
        for (size_t i = 0; i < n; i++) {
            if (i) write_single(' ');
            write_single(val[i]);
        }
    }
};
 
 
using ll=long long;
//#define int ll
 
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif
 
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
 
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
 
using pii=pair<int,int>;
using vi=vc<int>;
 
template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}
 
template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}
 
#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif
 
using uint=unsigned;
using ull=unsigned long long;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
 
template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}
 
template<int i,class T>
void print_tuple(ostream&,const T&){
}
 
template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}
 
template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}
 
template<class t>
void print(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}
 
ll read(){
	ll i;
	cin>>i;
	return i;
}
 
vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}
 
template<class T>
void print(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print(v[i],i==int(v.size())-1?suc:2);
}
 
string readString(){
	string s;
	cin>>s;
	return s;
}
 
template<class T>
T sq(const T& t){
	return t*t;
}
 
//#define CAPITAL
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
}
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
}
 
constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}
 
const ll infLL=LLONG_MAX/3;
 
#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif
 
int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
ll mask(int i){
	return (ll(1)<<i)-1;
}
 
template<class t>
bool inc(t a,t b,t c){
	return a<=b&&b<=c;
}
 
template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}
 
ll rand_int(ll l, ll r) { //[l, r]
	#ifdef LOCAL
	static mt19937_64 gen;
	#else
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    #endif
    return uniform_int_distribution<ll>(l, r)(gen);
}
 
template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}
 
struct modinfo{uint mod,root;};
template<modinfo const&ref>
struct modular{
	static constexpr uint const &mod=ref.mod;
	static modular root(){return modular(ref.root);}
	uint v;
	//modular(initializer_list<uint>ls):v(*ls.bg){}
	modular(ll vv=0){s(vv%mod+mod);}
	modular& s(uint vv){
		v=vv<mod?vv:vv-mod;
		return *this;
	}
	modular operator-()const{return modular()-*this;}
	modular& operator+=(const modular&rhs){return s(v+rhs.v);}
	modular&operator-=(const modular&rhs){return s(v+mod-rhs.v);}
	modular&operator*=(const modular&rhs){
		v=ull(v)*rhs.v%mod;
		return *this;
	}
	modular&operator/=(const modular&rhs){return *this*=rhs.inv();}
	modular operator+(const modular&rhs)const{return modular(*this)+=rhs;}
	modular operator-(const modular&rhs)const{return modular(*this)-=rhs;}
	modular operator*(const modular&rhs)const{return modular(*this)*=rhs;}
	modular operator/(const modular&rhs)const{return modular(*this)/=rhs;}
	modular pow(int n)const{
		modular res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}
	modular inv()const{return pow(mod-2);}
	/*modular inv()const{
		int x,y;
		int g=extgcd(v,mod,x,y);
		assert(g==1);
		if(x<0)x+=mod;
		return modular(x);
	}*/
	friend modular operator+(int x,const modular&y){
		return modular(x)+y;
	}
	friend modular operator-(int x,const modular&y){
		return modular(x)-y;
	}
	friend modular operator*(int x,const modular&y){
		return modular(x)*y;
	}
	friend modular operator/(int x,const modular&y){
		return modular(x)/y;
	}
	friend ostream& operator<<(ostream&os,const modular&m){
		return os<<m.v;
	}
	friend istream& operator>>(istream&is,modular&m){
		ll x;is>>x;
		m=modular(x);
		return is;
	}
	bool operator<(const modular&r)const{return v<r.v;}
	bool operator==(const modular&r)const{return v==r.v;}
	bool operator!=(const modular&r)const{return v!=r.v;}
	explicit operator bool()const{
		return v;
	}
};
extern constexpr modinfo base{1000000007,0};
using mint=modular<base>;
#define N_ 251000
vi E[N_], G[N_];
bool vis[N_];
vc<int> D[N_];
int M[N_], F[N_], Num[N_];
int main(){
	
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	Scanner sc(stdin);
	Printer pr(stdout);

    int n, m;
    sc.read(n,m);
    rep(i,m){
        int a, b;
        sc.read(a,b);
        E[a].pb(b);
        E[b].pb(a);
    }
    int K;
    sc.read(K);
    rng(i,1,n){
        M[i]=1;
        F[i]=-1;
    }
    rep(i,K){
        int l;
        sc.read(l);
        vi w(l);
        rep(j,l){
            sc.read(w[j]);
            M[w[j]] = l;
            F[w[j]] = j;
            Num[w[j]] = i+1;
        }
    }
    rng(i,1,n){
        D[i].resize(M[i]);
        rep(j,M[i]){
            D[i][j] = 1e9;
        }
    }
    rng(i,1,n){
        for(auto &x: E[i]){
            if(M[x]!=1)G[i].pb(x);
        }
    }
    priority_queue<pii>PQ;
    auto Put = [&](int a, int d) -> void {
        if(d%M[a]==F[a])return;
        if(D[a][d%M[a]] <= d)return;
        D[a][d%M[a]] = d;
        PQ.push({-d,a});
    };
    Put(1,0);
    auto Go = [&](int a, int d, vi &T) -> void{

        if(F[a] != (d+1)%M[a]){
            Put(a,d+1);
        }
        if(M[a] == 1){
            for(auto &x: T){
                if(M[x]==1){
                    Put(x,d+1);
                    continue;
                }
                if(F[x] == (d+1)%M[x]){
                    Put(x,d+2);
                }
                else{
                    Put(x,d+1);
                    int t = d/M[x]*M[x] + F[x] + 1;
                    while(t < d+1) t += M[x];
                    Put(x,t);
                }
            }
            return;
        }
        for(auto &x: T){
            if(Num[a] == Num[x]){
                int Mod = M[a];
                if(F[a] == (d+1)%Mod && F[x] == d%Mod)continue;
                if(F[x] == (d+1)%Mod){
                    if(F[a] != (d+2)%Mod) Put(x,d+2);
                }
                else Put(x,d+1);
            }
            else{
                rep(j,M[x]){
                    Put(x,d + j*M[a]+1);
                }
            }
        }
    };
    while(!PQ.empty()){
        auto [d,a] = PQ.top();
        PQ.pop();
        d = -d;
        if(D[a][d%M[a]] != d)continue;

        if(!vis[a]){
            Go(a, d, E[a]);
            vis[a] = 1;
        }
        else{
            Go(a, d, G[a]);
        }
    }
    int res = 1e9;
    rep(i,M[n]){
        res=min(res,D[n][i]);
    }
    if(res>8e8)puts("impossible");
    else printf("%d\n",res);
}
# Verdict Execution time Memory Grader output
1 Correct 34 ms 19148 KB Output is correct
2 Correct 69 ms 25540 KB Output is correct
3 Correct 74 ms 24852 KB Output is correct
4 Correct 94 ms 25208 KB Output is correct
5 Correct 11 ms 18124 KB Output is correct
6 Correct 59 ms 24952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 19116 KB Output is correct
2 Correct 64 ms 25556 KB Output is correct
3 Correct 92 ms 24860 KB Output is correct
4 Correct 87 ms 25148 KB Output is correct
5 Correct 14 ms 18124 KB Output is correct
6 Correct 59 ms 24904 KB Output is correct
7 Correct 55 ms 24832 KB Output is correct
8 Correct 57 ms 24932 KB Output is correct
9 Correct 60 ms 24900 KB Output is correct
10 Correct 64 ms 25264 KB Output is correct
11 Correct 60 ms 25160 KB Output is correct
12 Correct 59 ms 24900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 19116 KB Output is correct
2 Correct 64 ms 25556 KB Output is correct
3 Correct 92 ms 24860 KB Output is correct
4 Correct 87 ms 25148 KB Output is correct
5 Correct 14 ms 18124 KB Output is correct
6 Correct 59 ms 24904 KB Output is correct
7 Correct 55 ms 24832 KB Output is correct
8 Correct 57 ms 24932 KB Output is correct
9 Correct 60 ms 24900 KB Output is correct
10 Correct 64 ms 25264 KB Output is correct
11 Correct 60 ms 25160 KB Output is correct
12 Correct 59 ms 24900 KB Output is correct
13 Correct 37 ms 19208 KB Output is correct
14 Correct 63 ms 25556 KB Output is correct
15 Correct 59 ms 24912 KB Output is correct
16 Correct 79 ms 25164 KB Output is correct
17 Correct 11 ms 18160 KB Output is correct
18 Correct 61 ms 24904 KB Output is correct
19 Correct 60 ms 24836 KB Output is correct
20 Correct 55 ms 24836 KB Output is correct
21 Correct 55 ms 24900 KB Output is correct
22 Correct 62 ms 25204 KB Output is correct
23 Correct 59 ms 25164 KB Output is correct
24 Correct 57 ms 24920 KB Output is correct
25 Correct 940 ms 68564 KB Output is correct
26 Correct 848 ms 72904 KB Output is correct
27 Correct 754 ms 68680 KB Output is correct
28 Correct 662 ms 72768 KB Output is correct
29 Correct 918 ms 80956 KB Output is correct
30 Correct 938 ms 83364 KB Output is correct
31 Correct 1045 ms 72608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 19116 KB Output is correct
2 Correct 64 ms 25556 KB Output is correct
3 Correct 92 ms 24860 KB Output is correct
4 Correct 87 ms 25148 KB Output is correct
5 Correct 14 ms 18124 KB Output is correct
6 Correct 59 ms 24904 KB Output is correct
7 Correct 55 ms 24832 KB Output is correct
8 Correct 57 ms 24932 KB Output is correct
9 Correct 60 ms 24900 KB Output is correct
10 Correct 64 ms 25264 KB Output is correct
11 Correct 60 ms 25160 KB Output is correct
12 Correct 59 ms 24900 KB Output is correct
13 Correct 37 ms 19208 KB Output is correct
14 Correct 63 ms 25556 KB Output is correct
15 Correct 59 ms 24912 KB Output is correct
16 Correct 79 ms 25164 KB Output is correct
17 Correct 11 ms 18160 KB Output is correct
18 Correct 61 ms 24904 KB Output is correct
19 Correct 60 ms 24836 KB Output is correct
20 Correct 55 ms 24836 KB Output is correct
21 Correct 55 ms 24900 KB Output is correct
22 Correct 62 ms 25204 KB Output is correct
23 Correct 59 ms 25164 KB Output is correct
24 Correct 57 ms 24920 KB Output is correct
25 Correct 940 ms 68564 KB Output is correct
26 Correct 848 ms 72904 KB Output is correct
27 Correct 754 ms 68680 KB Output is correct
28 Correct 662 ms 72768 KB Output is correct
29 Correct 918 ms 80956 KB Output is correct
30 Correct 938 ms 83364 KB Output is correct
31 Correct 1045 ms 72608 KB Output is correct
32 Correct 36 ms 19128 KB Output is correct
33 Correct 66 ms 25492 KB Output is correct
34 Correct 68 ms 24848 KB Output is correct
35 Correct 86 ms 25208 KB Output is correct
36 Correct 11 ms 18124 KB Output is correct
37 Correct 60 ms 24900 KB Output is correct
38 Correct 56 ms 24832 KB Output is correct
39 Correct 58 ms 24832 KB Output is correct
40 Correct 56 ms 24900 KB Output is correct
41 Correct 62 ms 25284 KB Output is correct
42 Correct 58 ms 25136 KB Output is correct
43 Correct 72 ms 25064 KB Output is correct
44 Correct 900 ms 68504 KB Output is correct
45 Correct 852 ms 72876 KB Output is correct
46 Correct 756 ms 68680 KB Output is correct
47 Correct 653 ms 72964 KB Output is correct
48 Correct 952 ms 80928 KB Output is correct
49 Correct 940 ms 83380 KB Output is correct
50 Correct 984 ms 72580 KB Output is correct
51 Correct 1355 ms 77568 KB Output is correct
52 Correct 1538 ms 88060 KB Output is correct
53 Correct 1251 ms 78092 KB Output is correct
54 Correct 627 ms 64596 KB Output is correct
55 Execution timed out 6075 ms 100520 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 19148 KB Output is correct
2 Correct 69 ms 25540 KB Output is correct
3 Correct 74 ms 24852 KB Output is correct
4 Correct 94 ms 25208 KB Output is correct
5 Correct 11 ms 18124 KB Output is correct
6 Correct 59 ms 24952 KB Output is correct
7 Correct 34 ms 19116 KB Output is correct
8 Correct 64 ms 25556 KB Output is correct
9 Correct 92 ms 24860 KB Output is correct
10 Correct 87 ms 25148 KB Output is correct
11 Correct 14 ms 18124 KB Output is correct
12 Correct 59 ms 24904 KB Output is correct
13 Correct 55 ms 24832 KB Output is correct
14 Correct 57 ms 24932 KB Output is correct
15 Correct 60 ms 24900 KB Output is correct
16 Correct 64 ms 25264 KB Output is correct
17 Correct 60 ms 25160 KB Output is correct
18 Correct 59 ms 24900 KB Output is correct
19 Correct 10 ms 17992 KB Output is correct
20 Correct 10 ms 18056 KB Output is correct
21 Correct 9 ms 18088 KB Output is correct
22 Correct 36 ms 19208 KB Output is correct
23 Correct 72 ms 25544 KB Output is correct
24 Correct 75 ms 24836 KB Output is correct
25 Correct 84 ms 25288 KB Output is correct
26 Correct 12 ms 18164 KB Output is correct
27 Correct 60 ms 24944 KB Output is correct
28 Correct 55 ms 24932 KB Output is correct
29 Correct 55 ms 24900 KB Output is correct
30 Correct 58 ms 24836 KB Output is correct
31 Correct 62 ms 25284 KB Output is correct
32 Correct 62 ms 25204 KB Output is correct
33 Correct 58 ms 24900 KB Output is correct
34 Correct 937 ms 71340 KB Output is correct
35 Correct 975 ms 65440 KB Output is correct
36 Correct 985 ms 65384 KB Output is correct
37 Correct 849 ms 73504 KB Output is correct
38 Correct 917 ms 68264 KB Output is correct
39 Correct 953 ms 81048 KB Output is correct
40 Correct 1077 ms 82460 KB Output is correct
41 Correct 894 ms 81148 KB Output is correct
42 Correct 908 ms 68276 KB Output is correct
43 Correct 1002 ms 71896 KB Output is correct
44 Correct 973 ms 71872 KB Output is correct
45 Correct 1010 ms 67552 KB Output is correct
46 Correct 900 ms 68188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 19148 KB Output is correct
2 Correct 69 ms 25540 KB Output is correct
3 Correct 74 ms 24852 KB Output is correct
4 Correct 94 ms 25208 KB Output is correct
5 Correct 11 ms 18124 KB Output is correct
6 Correct 59 ms 24952 KB Output is correct
7 Correct 34 ms 19116 KB Output is correct
8 Correct 64 ms 25556 KB Output is correct
9 Correct 92 ms 24860 KB Output is correct
10 Correct 87 ms 25148 KB Output is correct
11 Correct 14 ms 18124 KB Output is correct
12 Correct 59 ms 24904 KB Output is correct
13 Correct 55 ms 24832 KB Output is correct
14 Correct 57 ms 24932 KB Output is correct
15 Correct 60 ms 24900 KB Output is correct
16 Correct 64 ms 25264 KB Output is correct
17 Correct 60 ms 25160 KB Output is correct
18 Correct 59 ms 24900 KB Output is correct
19 Correct 37 ms 19208 KB Output is correct
20 Correct 63 ms 25556 KB Output is correct
21 Correct 59 ms 24912 KB Output is correct
22 Correct 79 ms 25164 KB Output is correct
23 Correct 11 ms 18160 KB Output is correct
24 Correct 61 ms 24904 KB Output is correct
25 Correct 60 ms 24836 KB Output is correct
26 Correct 55 ms 24836 KB Output is correct
27 Correct 55 ms 24900 KB Output is correct
28 Correct 62 ms 25204 KB Output is correct
29 Correct 59 ms 25164 KB Output is correct
30 Correct 57 ms 24920 KB Output is correct
31 Correct 940 ms 68564 KB Output is correct
32 Correct 848 ms 72904 KB Output is correct
33 Correct 754 ms 68680 KB Output is correct
34 Correct 662 ms 72768 KB Output is correct
35 Correct 918 ms 80956 KB Output is correct
36 Correct 938 ms 83364 KB Output is correct
37 Correct 1045 ms 72608 KB Output is correct
38 Correct 10 ms 17992 KB Output is correct
39 Correct 10 ms 18056 KB Output is correct
40 Correct 9 ms 18088 KB Output is correct
41 Correct 36 ms 19208 KB Output is correct
42 Correct 72 ms 25544 KB Output is correct
43 Correct 75 ms 24836 KB Output is correct
44 Correct 84 ms 25288 KB Output is correct
45 Correct 12 ms 18164 KB Output is correct
46 Correct 60 ms 24944 KB Output is correct
47 Correct 55 ms 24932 KB Output is correct
48 Correct 55 ms 24900 KB Output is correct
49 Correct 58 ms 24836 KB Output is correct
50 Correct 62 ms 25284 KB Output is correct
51 Correct 62 ms 25204 KB Output is correct
52 Correct 58 ms 24900 KB Output is correct
53 Correct 937 ms 71340 KB Output is correct
54 Correct 975 ms 65440 KB Output is correct
55 Correct 985 ms 65384 KB Output is correct
56 Correct 849 ms 73504 KB Output is correct
57 Correct 917 ms 68264 KB Output is correct
58 Correct 953 ms 81048 KB Output is correct
59 Correct 1077 ms 82460 KB Output is correct
60 Correct 894 ms 81148 KB Output is correct
61 Correct 908 ms 68276 KB Output is correct
62 Correct 1002 ms 71896 KB Output is correct
63 Correct 973 ms 71872 KB Output is correct
64 Correct 1010 ms 67552 KB Output is correct
65 Correct 900 ms 68188 KB Output is correct
66 Correct 9 ms 17996 KB Output is correct
67 Correct 9 ms 17976 KB Output is correct
68 Correct 10 ms 17996 KB Output is correct
69 Correct 33 ms 19148 KB Output is correct
70 Correct 78 ms 25668 KB Output is correct
71 Correct 59 ms 24856 KB Output is correct
72 Correct 79 ms 25164 KB Output is correct
73 Correct 11 ms 18160 KB Output is correct
74 Correct 64 ms 25012 KB Output is correct
75 Correct 56 ms 24932 KB Output is correct
76 Correct 56 ms 24900 KB Output is correct
77 Correct 57 ms 24900 KB Output is correct
78 Correct 62 ms 25220 KB Output is correct
79 Correct 59 ms 25080 KB Output is correct
80 Correct 58 ms 24840 KB Output is correct
81 Correct 904 ms 68428 KB Output is correct
82 Correct 866 ms 72940 KB Output is correct
83 Correct 777 ms 68656 KB Output is correct
84 Correct 627 ms 72952 KB Output is correct
85 Correct 948 ms 80872 KB Output is correct
86 Correct 980 ms 83396 KB Output is correct
87 Correct 974 ms 72460 KB Output is correct
88 Correct 953 ms 71368 KB Output is correct
89 Correct 989 ms 65288 KB Output is correct
90 Correct 980 ms 65268 KB Output is correct
91 Correct 838 ms 73412 KB Output is correct
92 Correct 948 ms 68212 KB Output is correct
93 Correct 913 ms 81108 KB Output is correct
94 Correct 1067 ms 82444 KB Output is correct
95 Correct 914 ms 81304 KB Output is correct
96 Correct 947 ms 68344 KB Output is correct
97 Correct 992 ms 71888 KB Output is correct
98 Correct 1060 ms 72168 KB Output is correct
99 Correct 1073 ms 67644 KB Output is correct
100 Correct 922 ms 68260 KB Output is correct
101 Correct 950 ms 71904 KB Output is correct
102 Correct 863 ms 73840 KB Output is correct
103 Correct 966 ms 68740 KB Output is correct
104 Execution timed out 6101 ms 91620 KB Time limit exceeded
105 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 19148 KB Output is correct
2 Correct 69 ms 25540 KB Output is correct
3 Correct 74 ms 24852 KB Output is correct
4 Correct 94 ms 25208 KB Output is correct
5 Correct 11 ms 18124 KB Output is correct
6 Correct 59 ms 24952 KB Output is correct
7 Correct 34 ms 19116 KB Output is correct
8 Correct 64 ms 25556 KB Output is correct
9 Correct 92 ms 24860 KB Output is correct
10 Correct 87 ms 25148 KB Output is correct
11 Correct 14 ms 18124 KB Output is correct
12 Correct 59 ms 24904 KB Output is correct
13 Correct 55 ms 24832 KB Output is correct
14 Correct 57 ms 24932 KB Output is correct
15 Correct 60 ms 24900 KB Output is correct
16 Correct 64 ms 25264 KB Output is correct
17 Correct 60 ms 25160 KB Output is correct
18 Correct 59 ms 24900 KB Output is correct
19 Correct 37 ms 19208 KB Output is correct
20 Correct 63 ms 25556 KB Output is correct
21 Correct 59 ms 24912 KB Output is correct
22 Correct 79 ms 25164 KB Output is correct
23 Correct 11 ms 18160 KB Output is correct
24 Correct 61 ms 24904 KB Output is correct
25 Correct 60 ms 24836 KB Output is correct
26 Correct 55 ms 24836 KB Output is correct
27 Correct 55 ms 24900 KB Output is correct
28 Correct 62 ms 25204 KB Output is correct
29 Correct 59 ms 25164 KB Output is correct
30 Correct 57 ms 24920 KB Output is correct
31 Correct 940 ms 68564 KB Output is correct
32 Correct 848 ms 72904 KB Output is correct
33 Correct 754 ms 68680 KB Output is correct
34 Correct 662 ms 72768 KB Output is correct
35 Correct 918 ms 80956 KB Output is correct
36 Correct 938 ms 83364 KB Output is correct
37 Correct 1045 ms 72608 KB Output is correct
38 Correct 36 ms 19128 KB Output is correct
39 Correct 66 ms 25492 KB Output is correct
40 Correct 68 ms 24848 KB Output is correct
41 Correct 86 ms 25208 KB Output is correct
42 Correct 11 ms 18124 KB Output is correct
43 Correct 60 ms 24900 KB Output is correct
44 Correct 56 ms 24832 KB Output is correct
45 Correct 58 ms 24832 KB Output is correct
46 Correct 56 ms 24900 KB Output is correct
47 Correct 62 ms 25284 KB Output is correct
48 Correct 58 ms 25136 KB Output is correct
49 Correct 72 ms 25064 KB Output is correct
50 Correct 900 ms 68504 KB Output is correct
51 Correct 852 ms 72876 KB Output is correct
52 Correct 756 ms 68680 KB Output is correct
53 Correct 653 ms 72964 KB Output is correct
54 Correct 952 ms 80928 KB Output is correct
55 Correct 940 ms 83380 KB Output is correct
56 Correct 984 ms 72580 KB Output is correct
57 Correct 1355 ms 77568 KB Output is correct
58 Correct 1538 ms 88060 KB Output is correct
59 Correct 1251 ms 78092 KB Output is correct
60 Correct 627 ms 64596 KB Output is correct
61 Execution timed out 6075 ms 100520 KB Time limit exceeded
62 Halted 0 ms 0 KB -