1-SAT

AtCoder
IDabc187_c
Time2000ms
Memory256MB
Difficulty
Given are $N$ strings $S_1, S_2, \dots, S_N$. Each of these is a non-empty string consisting of lowercase English letters, with zero or one `!` added at the beginning. We say a string $T$ to be unsatisfied when it matches one of $S_1, S_2, \dots, S_N$ regardless of whether we add an `!` at the beginning of $T$. Determine whether there exists an unsatisfied string. If so, present one such string. ## Constraints * $1 \le N \le 2 \times 10^5$ * $1 \le |S_i| \le 10$ * $S_i$ is a non-empty string consisting of lowercase English letters, with zero or one `!` added at the beginning. ## Input Input is given from Standard Input in the following format: $N$ $S_1$ $\vdots$ $S_N$ [samples]
Samples
Input #1
6
a
!a
b
!c
d
!d
Output #1
a

`a` matches $S_1$ as is, and it matches $S_2$ when we add an `!`, so it is unsatisfied. Besides that, `d` will also be accepted.
Input #2
10
red
red
red
!orange
yellow
!blue
cyan
!green
brown
!gray
Output #2
satisfiable
API Response (JSON)
{
  "problem": {
    "name": "1-SAT",
    "description": {
      "content": "Given are $N$ strings $S_1, S_2, \\dots, S_N$. Each of these is a non-empty string consisting of lowercase English letters, with zero or one `!` added at the beginning.   We say a string $T$ to be unsa",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc187_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given are $N$ strings $S_1, S_2, \\dots, S_N$. Each of these is a non-empty string consisting of lowercase English letters, with zero or one `!` added at the beginning.  \nWe say a string $T$ to be unsa...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments