Big Clique Everywhere

AtCoder
IDagc067_a
Time4000ms
Memory256MB
Difficulty
You are given a simple undirected graph $G$ with $N$ vertices numbered $1$ to $N$. $G$ has $M$ edges and the $i$\-th edge connects vertices $A_i$ and $B_i$. Check if $G$ satisfies the following condition: * For every subset $X$ of the vertex set ${1,2,\cdots,N}$, there exists a subset $Y$ of $X$ such that $|Y|\ge \frac{|X|}{2}$ and $Y$ forms a clique. You have $T$ testcases to solve. ## Constraints * $1\le T \le 10^3$ * $1\le N \le 10^5$ * $0 \le M \le 10^6$ * $1 \le A_i,B_i \le N$ * The given graph doesn't contain self-loops or multiple edges. * The sum of $N$ across the test cases in a single input is at most $10^5$. * The sum of $M$ across the test cases in a single input is at most $10^6$. * All input values are integers. ## Input Input is given from Standard Input in the following format: $T$ $case_1$ $case_2$ $\vdots$ $case_T$ Each test case is given in the following format: $N$ $M$ $A_1$ $B_1$ $A_2$ $B_2$ $\vdots$ $A_M$ $B_M$ [samples]
Samples
Input #1
4
3 3
1 2
1 3
2 3
3 2
1 2
1 3
3 1
1 2
3 0
Output #1
Yes
Yes
Yes
No

For the $1$\-st test case, $G$ satisfies the condition. In this case, every subset $X$ is a clique, so we can just let $Y=X$.
For the $2$\-nd test case, $G$ satisfies the condition. For example, for $X={2,3}$, we can let $Y={2}$.
For the $4$\-th test case, $G$ doesn't satisfy the condition. If we let $X={1,2,3}$, no subset $Y$ of $X$ satisfies the condition.
API Response (JSON)
{
  "problem": {
    "name": "Big Clique Everywhere",
    "description": {
      "content": "You are given a simple undirected graph $G$ with $N$ vertices numbered $1$ to $N$. $G$ has $M$ edges and the $i$\\-th edge connects vertices $A_i$ and $B_i$. Check if $G$ satisfies the following condit",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 4000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "agc067_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a simple undirected graph $G$ with $N$ vertices numbered $1$ to $N$. $G$ has $M$ edges and the $i$\\-th edge connects vertices $A_i$ and $B_i$.\nCheck if $G$ satisfies the following condit...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments