답안 #528225

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
528225 2022-02-19T17:42:34 Z ainta From Hacks to Snitches (BOI21_watchmen) C++17
25 / 100
6000 ms 113720 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
#define LMAX 1500
vi E[N_], G[N_];
bool vis[N_];
vc<int> D[N_];
vc<vi>Nxt[LMAX+1];
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;
        }
        if(Nxt[l].empty()){
            Nxt[l].resize(l);
            rep(j,l){
                Nxt[l][j].resize(LMAX+1);
            }
        }
    }
    rng(i,1,LMAX){
        if(Nxt[i].empty())continue;
        rep(j,i){
            rng(k,1,LMAX){
                int t = j;
                while(1){
                    t += k;
                    if( (t%i < j || j == 0) && t%i){
                        Nxt[i][j][k] = t;
                        break;
                    }
                    if(t%i == j){
                        Nxt[i][j][k] = -1;
                        break;
                    }
                }
            }
        }
    }
    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{
                int cur = d + 1;
                while(1){
                    Put(x, cur);
                    if(M[x]==1)break;
                    int aft = (cur + M[x] - F[x])%M[x];
                    int c = Nxt[M[x]][aft][M[a]];
                    if(c==-1)break;
                    cur += c;
                }
            }
        }
    };
    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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 19908 KB Output is correct
2 Correct 93 ms 26728 KB Output is correct
3 Correct 84 ms 26092 KB Output is correct
4 Correct 103 ms 26388 KB Output is correct
5 Correct 19 ms 18912 KB Output is correct
6 Correct 91 ms 26180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 19920 KB Output is correct
2 Correct 83 ms 26728 KB Output is correct
3 Correct 71 ms 26068 KB Output is correct
4 Correct 107 ms 26388 KB Output is correct
5 Correct 20 ms 18892 KB Output is correct
6 Correct 79 ms 26132 KB Output is correct
7 Correct 70 ms 26060 KB Output is correct
8 Correct 65 ms 25992 KB Output is correct
9 Correct 76 ms 26032 KB Output is correct
10 Correct 100 ms 26460 KB Output is correct
11 Correct 69 ms 26340 KB Output is correct
12 Correct 71 ms 25996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 19920 KB Output is correct
2 Correct 83 ms 26728 KB Output is correct
3 Correct 71 ms 26068 KB Output is correct
4 Correct 107 ms 26388 KB Output is correct
5 Correct 20 ms 18892 KB Output is correct
6 Correct 79 ms 26132 KB Output is correct
7 Correct 70 ms 26060 KB Output is correct
8 Correct 65 ms 25992 KB Output is correct
9 Correct 76 ms 26032 KB Output is correct
10 Correct 100 ms 26460 KB Output is correct
11 Correct 69 ms 26340 KB Output is correct
12 Correct 71 ms 25996 KB Output is correct
13 Correct 47 ms 19908 KB Output is correct
14 Correct 98 ms 26824 KB Output is correct
15 Correct 73 ms 26148 KB Output is correct
16 Correct 121 ms 26372 KB Output is correct
17 Correct 18 ms 18892 KB Output is correct
18 Correct 73 ms 26140 KB Output is correct
19 Correct 88 ms 26104 KB Output is correct
20 Correct 92 ms 26012 KB Output is correct
21 Correct 70 ms 25988 KB Output is correct
22 Correct 92 ms 26344 KB Output is correct
23 Correct 76 ms 26276 KB Output is correct
24 Correct 79 ms 26048 KB Output is correct
25 Correct 1061 ms 73948 KB Output is correct
26 Correct 1024 ms 79408 KB Output is correct
27 Correct 906 ms 75016 KB Output is correct
28 Correct 721 ms 78928 KB Output is correct
29 Correct 1070 ms 86156 KB Output is correct
30 Correct 996 ms 85416 KB Output is correct
31 Correct 1054 ms 76120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 19920 KB Output is correct
2 Correct 83 ms 26728 KB Output is correct
3 Correct 71 ms 26068 KB Output is correct
4 Correct 107 ms 26388 KB Output is correct
5 Correct 20 ms 18892 KB Output is correct
6 Correct 79 ms 26132 KB Output is correct
7 Correct 70 ms 26060 KB Output is correct
8 Correct 65 ms 25992 KB Output is correct
9 Correct 76 ms 26032 KB Output is correct
10 Correct 100 ms 26460 KB Output is correct
11 Correct 69 ms 26340 KB Output is correct
12 Correct 71 ms 25996 KB Output is correct
13 Correct 47 ms 19908 KB Output is correct
14 Correct 98 ms 26824 KB Output is correct
15 Correct 73 ms 26148 KB Output is correct
16 Correct 121 ms 26372 KB Output is correct
17 Correct 18 ms 18892 KB Output is correct
18 Correct 73 ms 26140 KB Output is correct
19 Correct 88 ms 26104 KB Output is correct
20 Correct 92 ms 26012 KB Output is correct
21 Correct 70 ms 25988 KB Output is correct
22 Correct 92 ms 26344 KB Output is correct
23 Correct 76 ms 26276 KB Output is correct
24 Correct 79 ms 26048 KB Output is correct
25 Correct 1061 ms 73948 KB Output is correct
26 Correct 1024 ms 79408 KB Output is correct
27 Correct 906 ms 75016 KB Output is correct
28 Correct 721 ms 78928 KB Output is correct
29 Correct 1070 ms 86156 KB Output is correct
30 Correct 996 ms 85416 KB Output is correct
31 Correct 1054 ms 76120 KB Output is correct
32 Correct 41 ms 19992 KB Output is correct
33 Correct 73 ms 26724 KB Output is correct
34 Correct 95 ms 26188 KB Output is correct
35 Correct 106 ms 26352 KB Output is correct
36 Correct 19 ms 18848 KB Output is correct
37 Correct 71 ms 26136 KB Output is correct
38 Correct 81 ms 26056 KB Output is correct
39 Correct 68 ms 26056 KB Output is correct
40 Correct 61 ms 26052 KB Output is correct
41 Correct 75 ms 26440 KB Output is correct
42 Correct 65 ms 26400 KB Output is correct
43 Correct 76 ms 26172 KB Output is correct
44 Correct 1008 ms 71652 KB Output is correct
45 Correct 968 ms 77396 KB Output is correct
46 Correct 863 ms 73044 KB Output is correct
47 Correct 660 ms 76560 KB Output is correct
48 Correct 973 ms 83608 KB Output is correct
49 Correct 1010 ms 86928 KB Output is correct
50 Correct 1118 ms 76164 KB Output is correct
51 Correct 1627 ms 87940 KB Output is correct
52 Correct 2063 ms 105960 KB Output is correct
53 Correct 1617 ms 98636 KB Output is correct
54 Correct 806 ms 84596 KB Output is correct
55 Execution timed out 6011 ms 113720 KB Time limit exceeded
56 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 19908 KB Output is correct
2 Correct 93 ms 26728 KB Output is correct
3 Correct 84 ms 26092 KB Output is correct
4 Correct 103 ms 26388 KB Output is correct
5 Correct 19 ms 18912 KB Output is correct
6 Correct 91 ms 26180 KB Output is correct
7 Correct 49 ms 19920 KB Output is correct
8 Correct 83 ms 26728 KB Output is correct
9 Correct 71 ms 26068 KB Output is correct
10 Correct 107 ms 26388 KB Output is correct
11 Correct 20 ms 18892 KB Output is correct
12 Correct 79 ms 26132 KB Output is correct
13 Correct 70 ms 26060 KB Output is correct
14 Correct 65 ms 25992 KB Output is correct
15 Correct 76 ms 26032 KB Output is correct
16 Correct 100 ms 26460 KB Output is correct
17 Correct 69 ms 26340 KB Output is correct
18 Correct 71 ms 25996 KB Output is correct
19 Correct 12 ms 18100 KB Output is correct
20 Correct 12 ms 18108 KB Output is correct
21 Correct 11 ms 18112 KB Output is correct
22 Correct 45 ms 20564 KB Output is correct
23 Correct 98 ms 27400 KB Output is correct
24 Correct 81 ms 26812 KB Output is correct
25 Correct 97 ms 27120 KB Output is correct
26 Correct 19 ms 18860 KB Output is correct
27 Correct 74 ms 26832 KB Output is correct
28 Correct 73 ms 26796 KB Output is correct
29 Correct 69 ms 26740 KB Output is correct
30 Correct 78 ms 26744 KB Output is correct
31 Correct 73 ms 27100 KB Output is correct
32 Correct 66 ms 27084 KB Output is correct
33 Correct 71 ms 26860 KB Output is correct
34 Correct 1024 ms 76220 KB Output is correct
35 Correct 1074 ms 70900 KB Output is correct
36 Correct 1074 ms 70768 KB Output is correct
37 Execution timed out 6069 ms 78640 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 19908 KB Output is correct
2 Correct 93 ms 26728 KB Output is correct
3 Correct 84 ms 26092 KB Output is correct
4 Correct 103 ms 26388 KB Output is correct
5 Correct 19 ms 18912 KB Output is correct
6 Correct 91 ms 26180 KB Output is correct
7 Correct 49 ms 19920 KB Output is correct
8 Correct 83 ms 26728 KB Output is correct
9 Correct 71 ms 26068 KB Output is correct
10 Correct 107 ms 26388 KB Output is correct
11 Correct 20 ms 18892 KB Output is correct
12 Correct 79 ms 26132 KB Output is correct
13 Correct 70 ms 26060 KB Output is correct
14 Correct 65 ms 25992 KB Output is correct
15 Correct 76 ms 26032 KB Output is correct
16 Correct 100 ms 26460 KB Output is correct
17 Correct 69 ms 26340 KB Output is correct
18 Correct 71 ms 25996 KB Output is correct
19 Correct 47 ms 19908 KB Output is correct
20 Correct 98 ms 26824 KB Output is correct
21 Correct 73 ms 26148 KB Output is correct
22 Correct 121 ms 26372 KB Output is correct
23 Correct 18 ms 18892 KB Output is correct
24 Correct 73 ms 26140 KB Output is correct
25 Correct 88 ms 26104 KB Output is correct
26 Correct 92 ms 26012 KB Output is correct
27 Correct 70 ms 25988 KB Output is correct
28 Correct 92 ms 26344 KB Output is correct
29 Correct 76 ms 26276 KB Output is correct
30 Correct 79 ms 26048 KB Output is correct
31 Correct 1061 ms 73948 KB Output is correct
32 Correct 1024 ms 79408 KB Output is correct
33 Correct 906 ms 75016 KB Output is correct
34 Correct 721 ms 78928 KB Output is correct
35 Correct 1070 ms 86156 KB Output is correct
36 Correct 996 ms 85416 KB Output is correct
37 Correct 1054 ms 76120 KB Output is correct
38 Correct 12 ms 18100 KB Output is correct
39 Correct 12 ms 18108 KB Output is correct
40 Correct 11 ms 18112 KB Output is correct
41 Correct 45 ms 20564 KB Output is correct
42 Correct 98 ms 27400 KB Output is correct
43 Correct 81 ms 26812 KB Output is correct
44 Correct 97 ms 27120 KB Output is correct
45 Correct 19 ms 18860 KB Output is correct
46 Correct 74 ms 26832 KB Output is correct
47 Correct 73 ms 26796 KB Output is correct
48 Correct 69 ms 26740 KB Output is correct
49 Correct 78 ms 26744 KB Output is correct
50 Correct 73 ms 27100 KB Output is correct
51 Correct 66 ms 27084 KB Output is correct
52 Correct 71 ms 26860 KB Output is correct
53 Correct 1024 ms 76220 KB Output is correct
54 Correct 1074 ms 70900 KB Output is correct
55 Correct 1074 ms 70768 KB Output is correct
56 Execution timed out 6069 ms 78640 KB Time limit exceeded
57 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 19908 KB Output is correct
2 Correct 93 ms 26728 KB Output is correct
3 Correct 84 ms 26092 KB Output is correct
4 Correct 103 ms 26388 KB Output is correct
5 Correct 19 ms 18912 KB Output is correct
6 Correct 91 ms 26180 KB Output is correct
7 Correct 49 ms 19920 KB Output is correct
8 Correct 83 ms 26728 KB Output is correct
9 Correct 71 ms 26068 KB Output is correct
10 Correct 107 ms 26388 KB Output is correct
11 Correct 20 ms 18892 KB Output is correct
12 Correct 79 ms 26132 KB Output is correct
13 Correct 70 ms 26060 KB Output is correct
14 Correct 65 ms 25992 KB Output is correct
15 Correct 76 ms 26032 KB Output is correct
16 Correct 100 ms 26460 KB Output is correct
17 Correct 69 ms 26340 KB Output is correct
18 Correct 71 ms 25996 KB Output is correct
19 Correct 47 ms 19908 KB Output is correct
20 Correct 98 ms 26824 KB Output is correct
21 Correct 73 ms 26148 KB Output is correct
22 Correct 121 ms 26372 KB Output is correct
23 Correct 18 ms 18892 KB Output is correct
24 Correct 73 ms 26140 KB Output is correct
25 Correct 88 ms 26104 KB Output is correct
26 Correct 92 ms 26012 KB Output is correct
27 Correct 70 ms 25988 KB Output is correct
28 Correct 92 ms 26344 KB Output is correct
29 Correct 76 ms 26276 KB Output is correct
30 Correct 79 ms 26048 KB Output is correct
31 Correct 1061 ms 73948 KB Output is correct
32 Correct 1024 ms 79408 KB Output is correct
33 Correct 906 ms 75016 KB Output is correct
34 Correct 721 ms 78928 KB Output is correct
35 Correct 1070 ms 86156 KB Output is correct
36 Correct 996 ms 85416 KB Output is correct
37 Correct 1054 ms 76120 KB Output is correct
38 Correct 41 ms 19992 KB Output is correct
39 Correct 73 ms 26724 KB Output is correct
40 Correct 95 ms 26188 KB Output is correct
41 Correct 106 ms 26352 KB Output is correct
42 Correct 19 ms 18848 KB Output is correct
43 Correct 71 ms 26136 KB Output is correct
44 Correct 81 ms 26056 KB Output is correct
45 Correct 68 ms 26056 KB Output is correct
46 Correct 61 ms 26052 KB Output is correct
47 Correct 75 ms 26440 KB Output is correct
48 Correct 65 ms 26400 KB Output is correct
49 Correct 76 ms 26172 KB Output is correct
50 Correct 1008 ms 71652 KB Output is correct
51 Correct 968 ms 77396 KB Output is correct
52 Correct 863 ms 73044 KB Output is correct
53 Correct 660 ms 76560 KB Output is correct
54 Correct 973 ms 83608 KB Output is correct
55 Correct 1010 ms 86928 KB Output is correct
56 Correct 1118 ms 76164 KB Output is correct
57 Correct 1627 ms 87940 KB Output is correct
58 Correct 2063 ms 105960 KB Output is correct
59 Correct 1617 ms 98636 KB Output is correct
60 Correct 806 ms 84596 KB Output is correct
61 Execution timed out 6011 ms 113720 KB Time limit exceeded
62 Halted 0 ms 0 KB -