QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#388416#8551. DFS Order 5ucup-team112#AC ✓149ms18272kbC++2016.2kb2024-04-13 15:25:202024-04-13 15:25:20

Judging History

你现在查看的是最新测评结果

  • [2024-04-13 15:25:20]
  • 评测
  • 测评结果:AC
  • 用时:149ms
  • 内存:18272kb
  • [2024-04-13 15:25:20]
  • 提交

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;
template<typename T>
struct HLD{
  using D=long long;
  int n;
  vector<int>sz;//部分木サイズ
  vector<D>dep;
  vector<int>par;
  vector<int>head;
  Graph<T> &g;//隣接リスト
  vector<edge<T>>edges;//データ構造に乗せるedge列
  vector<int>in,out;//[in,out)で部分木、[ina,inb]でa~bのパス(aが上)
  vector<int>comp;//連結成分の根
  //inは頂点のindexを表す。また、edge列の下側の頂点である
  HLD(Graph<T> &g,int r=-1):g(g),n(g.size()){
    hld_build(r);
  }
  void hld_build(int root = -1){
    in.assign(n,-1);out.assign(n,-1);dep.assign(n,0);
    par.assign(n,-1);head.assign(n,-1);sz.assign(n,-1);comp.assign(n,-1);
    edges.assign(n,edge<T>());
    if(root == -1){//根がどこでも良い場合(森でも可)
      for(int i=0;i<n;i++){
        if(sz[i] == -1){
          head[i] = i;
          dfs_sz(i, 0, i);
          dfs_hld(i);
        }
      }
    }
    else{
      head[root] = root;
      dfs_sz(root, 0, root);
      dfs_hld(root);
    }
  }
  void dfs_sz(int k, D d,int r){
    sz[k] = 1;
    comp[k] = r;
	dep[k] = d;
    for(auto &e: g[k]){
      if(e.to == par[k])continue;
      par[e.to] = k;
      dfs_sz(e.to, d+e.cost, r);
      sz[k] += sz[e.to];
      if(g[k][0].to==par[k]||sz[e.to] > sz[g[k][0].to])swap(e, g[k][0]);
    }
  }
  int time = 0;
  void dfs_hld(int k){
    in[k] = time++;
    for(auto e:g[k]){
      if(e.to == par[k])continue;
      head[e.to] = (e.to == g[k][0].to ? head[k]: e.to);
      edges[time] = e;
      dfs_hld(e.to);
    }
    out[k] = time;
  }
  int lca(int p,int q){
    while(1){
      if(in[p] < in[q])swap(p,q);
      if(head[p] == head[q])return q;
      p = par[head[p]];
    }
  }
  vector<pair<int,int>>query_path(int p,int q,bool isEdge){
    int r=lca(p,q);
    vector<pair<int,int>>ret;
    for(int i=0;i<2;i++){
      if(i == 1)swap(p,q);
      while(1){
        if(isEdge&&p==r)break;
        if(head[p]==head[r]){
          ret.emplace_back(in[r]+(isEdge?1:i),in[p]+1);
          break;
        }
        ret.emplace_back(in[head[p]],in[p]+1);
        p = par[head[p]];
      }
    }
    return ret;
  }
  vector<vector<pair<int,int>>>query_order_path(int p,int q,bool isEdge){
	//非可換クエリ用、配列0を順番を反転したデータ構造に、配列1を通常のデータ構造に
    vector<vector<pair<int,int>>>ret(2);
    int r=lca(p,q);
    for(int i=0;i<2;i++){
      if(i == 1)swap(p,q);
      while(1){
        if(isEdge&&p==r)break;
        if(head[p]==head[r]){
          if(i==0) ret[i].emplace_back(n-(in[p]+1),n-(in[r]+(isEdge?1:i)));
          else ret[i].emplace_back(in[r]+(isEdge?1:i),in[p]+1);
          break;
        }
        if(i==0) ret[i].emplace_back(n-(in[p]+1),n-(in[head[p]]));
        else ret[i].emplace_back(in[head[p]],in[p]+1);
        p = par[head[p]];
      }
    }
    reverse(ret[1].begin(), ret[1].end());
    return ret;
  }
  pair<int,int>query_subtree(int p,bool isEdge){
    return make_pair(in[p]+isEdge,out[p]);
  }
  //uのv方向の子 子孫関係は前もって確認すること(in,outを見る)
  int child(int u,int v)const{
    while(1){
      if(head[u]==head[v]){
        v=g[u][0].to;
        break;
      }
      v=head[v];
      if(par[v]==u)break;
      v=par[v];
    }
    return v;
  }
  //uをv方向に一つ進めた頂点
  int move(int u,int v)const{
    assert(u!=v);
    if(in[u]<in[v]&&in[v]<out[u])return child(u,v);
    else return par[u];
  }
  D dist(int u,int v){
    return dep[u]+dep[v]-2*dep[lca(u,v)];
  }
  vector<int>rev_in;
  int climb(int u,int k){
    if(rev_in.empty()){
      rev_in.resize(n);
      for(int i=0;i<n;i++)rev_in[in[i]]=i;
    }
    int nd=max<int>(dep[u]-k, 0);
    while(dep[u]>nd){
      if(dep[head[u]]>nd){
        u=par[head[u]];
      }
      else{
        u=rev_in[in[head[u]]+nd-dep[head[u]]];
      }
    }
    return u;
  }
  int jump(int from,int to, int k){
    int r = lca(from, to);
    int d1 = dep[from] - dep[r];
    int d2 = dep[to] - dep[r];
    if(d1 + d2 < k)return -1;
    else if(k <= d1)return climb(from, k);
    else return climb(to, d1 + d2 - k); 
  }
  template<typename I>
  Graph<T>lca_tree(vector<I>&v){
    auto compare=[&](int x,int y){return in[x]<in[y];};
    sort(v.begin(),v.end(),compare);
    int sz1=v.size();
    for(int i=0;i<sz1-1;i++)v.push_back(lca(v[i],v[i+1]));
    sort(v.begin(),v.end(),compare);
    v.erase(unique(v.begin(),v.end()),v.end());
    int sz2=v.size();
    Graph<T>ret(sz2);
    stack<int>st;
    for(int i=0;i<sz2;i++){
      while(!st.empty()&&out[v[st.top()]]<=in[v[i]])st.pop();
      if(!st.empty()){
        ret[st.top()].emplace_back(i,dep[v[i]]-dep[v[st.top()]]);
        ret[i].emplace_back(st.top(),dep[v[i]]-dep[v[st.top()]]);
      }
      st.push(i);
    }
    return ret;
  }
};

void solve(){
	ll res=0,buf=0;
  bool judge = true;

  ll n,q;cin>>n>>q;
  auto g=readGraph<int>(n+1,n-1,0);
  g[0].EB(1,1);
  g[1].EB(0,1);
  HLD hld(g);
  while(q--){
    int k;cin>>k;
    vector<int>a(k);
    rep(i,0,k)cin>>a[i];
    int idx=0;
    bool sw=true;
    {
      auto b=a;
      sort(ALL(b));
      UNIQUE(b);
      if(b.size()!=k)sw=false;
    }
    auto dfs=[&](auto &&f,int v,bool climb,int pass)->void {
      int rem=g[v].size()-(v!=0);
      if(pass!=-1)rem--;
      //OUT(rem,v,idx,sw,g[v].size());
      while(sw&&idx<a.size()&&rem){
        if(pass==a[idx])sw=false;
        if(hld.par[a[idx]]==v){
          //OUT(v,pass,climb,a[idx]);
          idx++;
          f(f,a[idx-1],false,-1);
          rem--;
        }
        else{
          if(climb||rem==0)return;
          sw=false;
          return;
        }
      }
    };
    int counter=0;
    int pre=a[0];
    while(sw&&idx<a.size()){
      int pass=-1;
      int par=hld.par[a[idx]];
      if(idx!=0){
        if(hld.in[par]<hld.in[pre]&&hld.in[pre]<hld.out[par]){
          pass=hld.child(par,pre);
        }
        else{
          sw=false;
        }
      }
      //OUT(par,pass);
      int pidx=idx;
      dfs(dfs,par,true,pass);
      if(pidx==idx)sw=false;
      pre=par;
      //OUT(pidx,idx,sw);
    }
    ans1(sw);
  }
}

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;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3588kb

input:

6 7
1 2
1 3
2 4
3 5
2 6
2 4 1
2 4 2
2 4 3
2 4 4
2 4 5
2 4 6
6 1 2 6 4 3 5

output:

No
No
Yes
No
No
Yes
Yes

result:

ok 7 tokens

Test #2:

score: 0
Accepted
time: 30ms
memory: 3652kb

input:

10 100000
7 2
1 7
7 10
8 6
8 7
1 3
4 5
9 5
5 8
8 8 9 7 2 8 1 6 1
4 8 3 5 2
6 7 10 3 9 9 1
1 1
8 10 3 2 9 3 8 7 3
7 5 6 2 8 5 9 1
6 3 4 6 2 1 3
5 8 9 2 4 9
1 3
2 1 5
5 8 5 1 7 9
10 5 2 9 2 6 4 10 6 3 8
3 4 5 8
2 8 4
9 4 10 1 2 4 3 3 6 3
1 3
6 1 1 6 8 3 1
3 7 3 2
3 9 1 5
4 3 7 8 10
9 4 2 3 10 2 5 4 3 ...

output:

No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 100000 tokens

Test #3:

score: 0
Accepted
time: 58ms
memory: 3628kb

input:

20 95326
19 7
11 14
15 14
6 12
14 13
2 9
1 15
4 7
16 14
13 10
13 17
13 20
10 5
16 18
7 6
9 11
3 2
12 16
2 8
17 11 3 20 16 6 1 6 11 3 14 6 6 17 4 20 10 2
14 19 8 6 12 8 8 12 20 1 5 3 18 12 13
13 16 3 8 12 13 6 19 18 5 8 14 19 15
3 8 11 16
9 18 19 2 19 2 17 16 7 10
3 18 11 13
1 12
19 10 5 20 4 6 17 18...

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No...

result:

ok 95326 tokens

Test #4:

score: 0
Accepted
time: 64ms
memory: 3892kb

input:

30 64393
17 20
17 6
29 13
26 9
11 13
17 5
12 27
5 1
25 28
3 20
28 13
19 29
22 14
21 13
18 10
3 4
30 27
15 21
21 23
8 10
21 24
27 14
9 7
28 16
7 3
2 7
7 27
3 18
29 27
15 14 2 24 21 24 24 22 6 5 12 12 4 20 26 28
22 22 14 7 30 19 13 16 29 9 18 14 14 14 4 8 14 25 11 6 25 22 11
28 10 10 7 1 22 7 6 14 12 ...

output:

No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 64393 tokens

Test #5:

score: 0
Accepted
time: 58ms
memory: 3544kb

input:

40 48628
34 2
10 30
26 16
3 9
29 13
12 25
38 34
22 7
16 5
22 13
8 27
23 30
39 6
24 15
20 13
4 17
15 14
2 19
25 32
5 10
17 1
18 11
9 28
31 36
31 20
11 8
40 16
5 24
1 20
30 39
37 31
10 20
14 34
12 8
16 12
17 21
33 30
24 35
10 3
38 14 31 3 33 14 21 38 3 16 32 4 6 32 1 36 6 7 20 40 16 8 28 39 9 36 13 33...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 48628 tokens

Test #6:

score: 0
Accepted
time: 61ms
memory: 3600kb

input:

50 39193
24 17
12 8
47 31
12 2
23 37
29 41
38 20
19 23
27 40
42 48
1 26
24 41
39 35
32 24
6 4
41 11
9 13
13 26
37 8
41 50
24 5
27 4
34 14
7 42
16 4
45 41
21 28
49 13
26 46
10 3
18 23
24 39
48 8
33 8
14 13
25 42
36 21
4 22
43 38
44 9
4 47
38 29
37 45
11 10
48 21
38 26
47 13
27 15
30 36
36 26 13 6 34 ...

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 39193 tokens

Test #7:

score: 0
Accepted
time: 38ms
memory: 3664kb

input:

10 100000
7 2
1 7
7 10
8 6
8 7
1 3
4 5
9 5
5 8
8 9 1 5 2 10 7 6 4
4 7 3 4 2
6 1 6 8 3 4 2
1 4
8 2 7 6 4 5 3 1 9
7 5 2 4 1 6 9 8
6 1 8 6 2 3 10
5 2 7 3 8 9
1 7
2 3 8
5 1 6 5 7 8
10 1 7 2 10 5 9 8 3 4 6
3 6 4 5
2 9 1
9 3 6 4 10 5 2 7 8 1
1 7
6 1 7 5 2 10 6
3 6 7 8
3 3 2 5
4 5 1 8 4
9 4 10 8 9 1 2 7 3 ...

output:

No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #8:

score: 0
Accepted
time: 35ms
memory: 3904kb

input:

10 100000
8 2
10 4
8 1
2 7
5 7
9 10
10 1
1 6
3 4
6 9 7 8 3 1 5
8 1 9 2 3 10 5 4 7
3 5 8 1
9 7 1 4 10 9 6 2 5 8
2 10 4
6 7 2 1 10 9 4
3 8 9 4
5 3 9 5 6 4
6 2 5 9 8 7 1
8 6 7 1 2 9 4 10 5
8 3 5 8 9 4 2 10 1
8 10 1 7 2 8 9 6 4
4 6 9 4 2
5 10 3 9 8 2
8 9 10 8 6 7 5 2 4
8 5 8 7 6 3 4 9 1
1 3
1 4
5 8 6 3 ...

output:

No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #9:

score: 0
Accepted
time: 34ms
memory: 3608kb

input:

10 100000
6 8
1 5
4 2
7 5
3 4
10 1
9 7
3 7
6 5
6 10 8 1 7 3 5
9 4 6 5 1 7 8 2 9 3
3 8 4 9
1 4
3 7 10 4
6 1 8 9 3 6 2
6 6 7 3 4 1 5
3 9 5 7
6 4 7 2 9 3 10
6 2 9 3 4 1 10
8 9 4 1 7 2 6 5 10
8 10 7 8 2 3 9 6 1
4 10 1 2 7
6 1 7 9 5 2 4
3 3 7 1
7 5 10 1 8 6 2 9
3 6 9 1
6 10 5 7 9 6 1
3 6 1 7
9 6 10 4 7 9...

output:

No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
Yes
No
No
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #10:

score: 0
Accepted
time: 31ms
memory: 3888kb

input:

10 100000
5 9
7 2
3 4
5 2
6 3
5 3
8 5
10 9
9 1
5 3 6 10 4 9
3 8 1 10
6 8 9 6 4 5 1
8 2 9 7 5 6 4 10 8
1 10
9 9 2 7 10 4 5 8 1 6
2 10 6
1 7
1 6
9 1 6 10 7 3 4 5 2 9
8 6 4 5 7 3 1 9 2
1 7
4 1 4 8 7
5 2 8 3 5 9
6 8 4 1 5 7 10
4 4 3 2 7
8 4 2 9 5 10 3 8 6
4 1 5 4 7
5 8 5 9 2 1
2 9 2
10 4 9 7 3 6 5 2 8 1...

output:

No
No
No
No
Yes
No
No
Yes
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
...

result:

ok 100000 tokens

Test #11:

score: 0
Accepted
time: 34ms
memory: 3656kb

input:

10 100000
4 6
10 8
7 2
4 7
6 5
1 7
3 2
5 10
9 1
9 6 7 5 10 9 4 8 1 3
3 2 7 6
6 7 4 3 5 1 6
4 9 8 6 3
10 9 10 6 8 2 1 5 3 7 4
8 3 2 5 7 8 4 1 10
5 2 6 3 10 5
3 3 1 2
10 10 3 4 8 9 6 2 7 5 1
1 10
9 2 9 6 7 8 1 3 4 5
9 1 7 6 5 2 9 4 8 3
6 2 10 9 4 6 3
7 7 4 5 3 10 8 9
1 4
1 6
4 5 4 7 2
4 2 1 9 7
3 7 3 ...

output:

No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No...

result:

ok 100000 tokens

Test #12:

score: 0
Accepted
time: 62ms
memory: 3828kb

input:

20 95326
19 7
11 14
15 14
6 12
14 13
2 9
1 15
4 7
16 14
13 10
13 17
13 20
10 5
16 18
7 6
9 11
3 2
12 16
2 8
17 13 10 14 12 2 19 9 8 17 15 3 6 16 18 11 7 20
14 2 19 14 20 13 3 6 5 1 12 17 11 7 16
13 6 11 2 19 15 5 13 12 16 4 17 1 7
3 15 10 6
9 14 7 17 8 19 13 2 12 1
3 10 13 9
1 19
19 11 16 1 4 3 20 1...

output:

No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
N...

result:

ok 95326 tokens

Test #13:

score: 0
Accepted
time: 59ms
memory: 3612kb

input:

30 64393
17 20
17 6
29 13
26 9
11 13
17 5
12 27
5 1
25 28
3 20
28 13
19 29
22 14
21 13
18 10
3 4
30 27
15 21
21 23
8 10
21 24
27 14
9 7
28 16
7 3
2 7
7 27
3 18
29 27
15 5 15 26 12 3 4 13 27 7 9 16 14 22 25 11
22 25 24 15 17 14 23 16 26 7 1 13 29 27 20 28 10 2 19 21 4 11 22
28 3 16 20 9 29 21 2 19 17...

output:

No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 64393 tokens

Test #14:

score: 0
Accepted
time: 57ms
memory: 3548kb

input:

40 48628
34 2
10 30
26 16
3 9
29 13
12 25
38 34
22 7
16 5
22 13
8 27
23 30
39 6
24 15
20 13
4 17
15 14
2 19
25 32
5 10
17 1
18 11
9 28
31 36
31 20
11 8
40 16
5 24
1 20
30 39
37 31
10 20
14 34
12 8
16 12
17 21
33 30
24 35
10 3
38 32 5 30 12 1 25 35 26 37 19 13 40 14 6 17 29 3 8 2 18 38 24 36 31 34 22...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 48628 tokens

Test #15:

score: 0
Accepted
time: 49ms
memory: 3592kb

input:

50 39193
24 17
12 8
47 31
12 2
23 37
29 41
38 20
19 23
27 40
42 48
1 26
24 41
39 35
32 24
6 4
41 11
9 13
13 26
37 8
41 50
24 5
27 4
34 14
7 42
16 4
45 41
21 28
49 13
26 46
10 3
18 23
24 39
48 8
33 8
14 13
25 42
36 21
4 22
43 38
44 9
4 47
38 29
37 45
11 10
48 21
38 26
47 13
27 15
30 36
36 44 47 14 48...

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 39193 tokens

Test #16:

score: 0
Accepted
time: 26ms
memory: 3624kb

input:

10 100000
4 1
3 6
7 4
2 6
5 7
8 6
4 9
4 6
10 7
4 8 2 1 9
3 2 4 7
3 3 2 8
3 10 1 2
1 3
5 2 8 4 1 9
3 5 1 9
7 4 9 1 7 5 10 8
1 2
3 4 9 6
9 9 4 6 3 2 8 7 5 10
4 6 4 1 7
3 6 8 2
1 1
2 6 3
4 9 7 10 5
6 9 6 3 2 8 7
5 7 10 5 9 6
2 5 4
1 4
2 9 1
2 2 3
1 3
5 9 1 6 2 8
5 6 4 7 5 10
3 9 1 6
7 7 5 10 6 8 3 2
2 ...

output:

No
No
Yes
No
Yes
No
No
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes...

result:

ok 100000 tokens

Test #17:

score: 0
Accepted
time: 21ms
memory: 3896kb

input:

10 100000
10 6
1 9
5 6
3 7
3 9
1 8
4 6
3 2
6 9
2 3 7
2 5 6
2 1 8
2 10 4
4 9 6 5 4
6 5 10 9 1 8 3
1 5
6 4 9 1 8 3 2
1 5
3 3 2 7
4 7 2 1 8
1 7
3 5 4 9
1 2
1 9
3 4 10 5
5 5 10 4 3 2
1 3
1 5
3 10 5 4
4 5 10 1 8
5 4 9 1 8 3
7 8 1 9 6 5 4 10
6 6 9 3 7 2 1
6 6 4 5 10 3 2
8 3 9 1 8 6 4 5 10
4 6 5 10 9
1 4
6...

output:

Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
Y...

result:

ok 100000 tokens

Test #18:

score: 0
Accepted
time: 22ms
memory: 3596kb

input:

10 100000
10 6
9 4
6 3
1 6
2 7
8 6
7 5
9 6
7 6
1 10
3 8 10 2
1 9
3 1 3 7
4 10 9 4 3
6 6 8 3 9 4 7
2 9 4
2 1 9
1 4
1 6
10 7 5 2 6 9 4 8 10 3 1
2 3 10
3 1 9 4
3 8 9 4
1 4
1 7
1 3
3 9 6 7
2 8 7
1 3
7 7 6 10 1 9 4 3
9 9 4 6 10 7 2 5 3 8
4 4 6 10 7
1 5
4 4 10 8 3
2 2 7
1 7
1 3
4 1 8 3 10
7 6 10 3 7 5 2 1...

output:

Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
No
No
Yes
No
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #19:

score: 0
Accepted
time: 25ms
memory: 3660kb

input:

10 100000
3 1
4 3
6 1
3 10
7 9
7 1
2 7
2 8
5 1
3 8 5 6
4 5 1 6 3
1 2
1 2
1 10
5 7 9 1 5 3
3 8 9 1
2 8 6
2 9 6
2 10 6
4 1 6 5 3
1 9
2 10 4
8 4 1 5 6 7 9 2 8
3 7 2 8
3 8 2 7
5 6 7 2 8 9
3 8 1 5
1 8
5 7 9 2 8 4
3 7 2 8
5 3 10 4 6 9
2 10 4
1 4
3 2 8 9
6 6 1 7 2 8 9
4 2 8 1 6
2 2 7
4 9 1 6 5
4 9 2 8 1
9 ...

output:

Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
No
No
No
No
No
No
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Y...

result:

ok 100000 tokens

Test #20:

score: 0
Accepted
time: 22ms
memory: 3824kb

input:

10 100000
7 5
3 2
7 6
7 4
8 7
7 2
7 1
10 8
7 9
5 7 8 10 6 1
2 7 5
8 8 7 4 9 1 2 3 5
3 6 8 10
1 4
7 1 2 3 6 8 10 9
3 1 7 9
1 5
4 10 9 6 1
2 9 8
2 2 3
4 5 1 2 3
2 1 4
4 1 7 5 9
6 8 10 9 2 3 6
2 4 5
6 5 2 3 1 4 9
3 5 9 4
1 1
1 6
10 4 7 8 10 2 3 9 6 1 5
2 5 4
4 1 4 2 3
1 2
4 6 4 9 8
2 4 1
3 6 8 10
4 10 ...

output:

No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
No
Yes
Yes
Yes
No
Ye...

result:

ok 100000 tokens

Test #21:

score: 0
Accepted
time: 41ms
memory: 3628kb

input:

20 100000
2 12
3 20
1 8
8 11
9 1
5 4
16 11
5 10
3 13
11 10
6 15
6 20
18 20
12 7
15 19
5 20
17 20
14 17
12 20
7 12 2 7 3 13 5 10
8 5 10 11 8 1 9 16 4
1 18
1 7
2 8 11
8 10 5 20 6 15 19 17 14
3 1 9 16
2 1 9
2 3 13
5 3 13 12 2 7
7 14 3 13 12 2 7 18
5 13 12 7 2 19
9 1 9 16 4 3 13 6 15 19
10 3 13 18 17 14...

output:

No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
No
Yes
No
Yes
No
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
Yes
No
No
No
No
Yes
Yes
No
No
Yes
No
Yes
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
No
Yes...

result:

ok 100000 tokens

Test #22:

score: 0
Accepted
time: 53ms
memory: 3908kb

input:

30 100000
6 16
17 23
11 10
16 23
4 23
27 10
25 8
6 26
2 14
13 19
28 30
24 3
13 14
20 7
14 29
1 6
21 5
3 2
12 1
10 28
22 23
1 13
11 20
15 10
11 21
9 22
10 8
6 11
20 18
7 6 16 23 17 4 22 9
18 23 17 4 22 9 26 11 10 27 8 25 28 30 15 20 7 18 21
7 19 14 29 2 3 24 12
10 6 11 20 7 18 21 5 10 15 27
10 26 16 ...

output:

Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
No
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
No
No
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
No
No
Yes
No
No...

result:

ok 100000 tokens

Test #23:

score: 0
Accepted
time: 61ms
memory: 3660kb

input:

40 92713
3 1
26 13
26 21
14 4
23 14
33 3
7 28
36 19
39 34
23 38
8 39
39 36
19 23
20 14
32 36
26 14
9 2
25 27
40 16
13 30
14 28
17 6
17 34
26 10
14 9
22 31
19 25
20 24
37 11
39 29
2 16
31 37
32 35
3 24
12 17
15 9
10 18
36 11
6 5
10 25 27 36 11 37 31 22 32 35 39
3 31 22 39
18 24 3 33 1 26 10 18 13 30 ...

output:

Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
Yes
No
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
No
No
Yes
No
No
No
Yes
Yes
Yes
No
No
Yes
Yes
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
Y...

result:

ok 92713 tokens

Test #24:

score: 0
Accepted
time: 64ms
memory: 3600kb

input:

50 75394
30 25
34 23
50 31
47 6
27 7
17 28
37 30
14 24
44 36
34 49
5 2
31 19
8 36
30 38
29 43
6 34
31 45
7 24
38 12
2 43
33 38
1 8
46 11
33 18
3 31
8 30
40 31
44 21
15 30
25 29
4 10
33 16
30 34
31 28
38 41
13 19
38 31
48 31
36 42
36 10
45 20
7 22
21 32
22 44
11 29
39 25
9 43
26 25
33 35
36 9 11 46 1...

output:

No
Yes
Yes
Yes
No
No
No
Yes
No
Yes
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
No
No
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
Yes
No
No
No
No
Yes
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
No
No
Yes
No
Yes
No
Yes
No...

result:

ok 75394 tokens

Test #25:

score: 0
Accepted
time: 46ms
memory: 14980kb

input:

100000 100000
22031 19709
79977 20677
72195 10689
88600 65820
9422 9595
3821 93983
96434 92645
72154 63751
88298 50712
58441 10216
66429 11541
80376 50932
50750 3251
39637 9534
35886 1323
34267 26052
61878 74481
49528 38924
69738 16187
99731 43694
18246 31836
68871 3281
17124 1158
95557 48000
65959 ...

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 100000 tokens

Test #26:

score: 0
Accepted
time: 47ms
memory: 13908kb

input:

100000 100000
6390 17242
19936 20882
46229 37775
87701 45891
93858 43746
24030 30025
21273 3891
8969 19204
31507 99402
31610 22619
57908 71859
86596 48565
69684 42945
81569 46463
11482 1436
69395 25798
83954 12570
38345 22133
99955 65046
47955 34204
37747 85317
19733 67085
12058 1916
8229 88515
3055...

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No...

result:

ok 100000 tokens

Test #27:

score: 0
Accepted
time: 62ms
memory: 13956kb

input:

100000 100000
65796 41231
47215 20437
14648 92497
7368 16204
1057 12939
57423 58031
90889 26728
19075 73300
16433 75923
44452 80414
69850 59598
99777 15742
35503 49371
20702 80793
88570 51926
92517 94171
37244 20383
29247 19506
81624 62559
2926 63517
96697 65725
29639 38173
74903 34618
313 16309
299...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #28:

score: 0
Accepted
time: 59ms
memory: 13904kb

input:

100000 100000
49565 66073
21944 4457
28322 40724
77401 81004
433 54017
3920 51304
21061 36288
14752 22530
92090 5883
9978 78398
92537 35543
88335 45607
83800 53358
77729 40863
1541 42486
96162 58764
41980 21524
83274 15162
84917 67941
74664 63431
54624 33582
35792 18967
29901 70394
38286 61456
86428...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #29:

score: 0
Accepted
time: 49ms
memory: 13940kb

input:

100000 100000
1766 4748
32844 9107
73356 52002
29127 35776
77551 96310
6586 12633
931 30529
97055 93805
71514 17120
15322 89816
48447 85139
69178 18689
88038 53343
18983 2203
31527 99630
92008 23951
82997 93138
74484 96972
36465 83542
10207 38726
70768 90541
6516 33979
57143 27898
2602 94702
72636 2...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #30:

score: 0
Accepted
time: 112ms
memory: 15104kb

input:

100000 100000
38656 38649
49244 49240
72097 72092
16362 16367
89712 89708
31833 31828
1776 1769
28913 28906
61888 61878
7131 7124
28437 28442
20338 20329
68540 68539
31334 31328
83244 83234
6344 6343
53941 53948
78386 78388
40417 40413
97136 97140
17048 17039
74885 74879
37932 37939
72242 72240
9052...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #31:

score: 0
Accepted
time: 117ms
memory: 14144kb

input:

100000 100000
91113 91209
82125 82196
17061 17030
63492 63450
86825 86766
20090 20048
98842 98857
83335 83270
8996 9015
65800 65720
49122 49155
84038 84135
45583 45609
71664 71592
80151 80184
55978 56066
84122 84142
47884 47984
6616 6659
24124 24141
44203 44230
88031 87936
21094 21143
52361 52425
93...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #32:

score: 0
Accepted
time: 110ms
memory: 13916kb

input:

100000 100000
50728 50654
44261 45163
22208 22565
58688 58373
32612 33030
71660 71873
89913 89664
75805 76744
71503 71934
27322 28111
55812 55356
33720 32754
48440 48264
41048 41781
93214 94182
17629 17722
17561 18146
28329 27383
98169 98356
1216 1055
84703 84515
2881 2084
87390 88222
21264 21663
43...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #33:

score: 0
Accepted
time: 110ms
memory: 14056kb

input:

100000 100000
31222 33552
41521 44119
50990 49903
44464 43003
15190 22921
47485 53253
74261 79380
85164 93724
59780 55724
93738 98324
63895 60609
21017 18180
433 773
93075 97786
8027 11031
12196 12724
97981 90548
96946 87968
93529 86667
20125 16341
63577 54107
90336 99374
52847 52441
35212 35612
691...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #34:

score: 0
Accepted
time: 122ms
memory: 14176kb

input:

100000 100000
12095 71885
9520 19536
6341 58535
9549 31319
17658 31062
26096 84345
55575 98102
41278 39200
54189 4024
9555 15722
84991 33220
57827 29323
17571 57697
89020 37327
13499 12471
15923 46106
46684 27028
68544 94977
72265 95916
25582 17437
84373 12019
40053 70207
30578 14849
99726 5741
8896...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #35:

score: 0
Accepted
time: 27ms
memory: 13964kb

input:

100000 100000
58286 1
92801 1
1 23835
31111 1
63517 1
1 64597
85533 1
22562 1
1 88412
75722 1
1 59697
92715 1
1 81332
74340 1
871 1
1 21972
1 54497
66797 1
10937 1
1 80448
29777 1
8287 1
1 65626
82496 1
88110 1
81770 1
79830 1
64455 1
1 5287
54867 1
19241 1
84920 1
40595 1
1 91660
86005 1
9536 1
1 4...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #36:

score: 0
Accepted
time: 47ms
memory: 14016kb

input:

100000 100000
1 31153
1 70648
65640 2
2 42097
1 30566
79120 79118
79694 79695
1 15175
58998 58996
46344 2
60522 1
69811 69809
2 10516
2 29288
84465 2
43108 2
46861 1
1 79362
85016 1
2 33704
2 65391
83512 83511
96951 1
62813 62814
1 80646
2 54179
88522 88521
29945 2
57863 2
2 22120
86745 1
8607 2
325...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #37:

score: 0
Accepted
time: 57ms
memory: 13884kb

input:

100000 100000
4 6165
61280 61285
79316 79317
75138 75139
3294 3
1 81489
10503 4
11462 4
95690 95693
6053 2
3 34295
66316 66320
9365 4
35707 5
2 4704
1 51638
13980 4
17619 5
14348 5
1 1157
38076 3
99377 99376
42362 3
58971 58969
2 48323
70177 3
5 10946
76634 76633
1 97298
5 44538
77954 1
16166 4
7346...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #38:

score: 0
Accepted
time: 58ms
memory: 14092kb

input:

100000 100000
69019 69027
10 20115
79300 79296
66171 66164
98706 98700
4 47454
57286 57289
78954 78960
92664 92658
5 24956
1 3044
55786 55795
73188 8
9 2296
67932 67937
8528 9
81852 81842
33011 10
51298 51293
67010 2
95125 95119
54265 4
1 35228
61407 61406
82568 82562
3 26672
5 16416
74458 74467
296...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #39:

score: 0
Accepted
time: 64ms
memory: 14224kb

input:

100000 100000
35 23329
87458 87437
35 99794
57784 57747
39576 3
76333 76305
49205 29
2218 21
65211 65244
36543 48
96822 96776
10507 12
77139 77096
17 337
11 19269
63630 63601
26 2484
23942 26
6 19197
89865 89888
87821 87823
15698 22
2617 8
38048 3
37076 28
17 2205
66500 66504
51236 51277
86214 86203...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #40:

score: 0
Accepted
time: 60ms
memory: 14176kb

input:

100000 100000
46 29253
32 11065
75112 75016
97872 97943
83462 83559
55450 55378
2 14708
89044 88960
98802 98709
88777 88765
83571 83601
37363 60
57778 57821
12825 71
42 13650
68 27305
9 25066
52407 52445
92990 92923
79698 79702
38704 66
75102 75030
64 3133
47898 1
3047 64
41 46208
51715 51738
93 669...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #41:

score: 0
Accepted
time: 50ms
memory: 18272kb

input:

100000 100000
64269 64268
66535 66536
9759 9758
42907 42908
80000 84213
80000 83489
27749 27748
86199 80000
80000 80659
11615 11614
93420 1
2529 2528
96161 1
79473 79474
83518 80000
43109 43110
37111 37112
46604 46603
1 93666
54540 54541
84237 80000
62717 62718
24720 24719
57226 57225
8333 8334
1572...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #42:

score: 0
Accepted
time: 149ms
memory: 15080kb

input:

100000 37
29162 63623
96664 54044
11535 67257
10642 29054
10206 58115
95878 4300
94836 69937
78765 28295
22874 53200
43075 87524
13107 77611
7813 13031
51591 40743
7168 67498
25699 32495
7125 37661
28803 9718
18154 16537
86140 56605
89290 3771
36638 63730
57297 68534
25220 8566
98229 56905
48005 462...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 37 tokens

Test #43:

score: 0
Accepted
time: 139ms
memory: 15108kb

input:

100000 33
60074 18401
35678 11648
38252 92824
51971 94160
24926 70750
19026 46634
14302 30542
40772 16995
74011 54458
39554 11112
15458 2470
40516 48499
47136 92413
74957 81119
86949 69165
2914 22736
93669 29627
81851 64391
96131 18955
85414 48801
11987 81925
44883 43397
57347 15860
25315 42763
2252...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 33 tokens

Test #44:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

1 1
1 1

output:

Yes

result:

ok "Yes"

Extra Test:

score: 0
Extra Test Passed