Account
Draft saved on this device
▤ DescriptionOriginal CppValley problem
Design PatternsEasy

Implement A Singleton Configuration Holder

A process has one configuration registry.

A process has one configuration registry. SET key value creates or overwrites an integer value. GET key prints its value or NONE if unset. All operations address the same global registry instance. A plain map is sufficient for the serialized input representation.

Input format

First line Q; next Q lines SET key integerValue or GET key.

Output format

Print the result of each GET.

Examples

Example 1
Input
5
SET mode 3
GET mode
GET x
SET mode 4
GET mode
Expected output
3
NONE
4

Constraints

  • 0 ≤ Q ≤ 100000
  • 1 ≤ key length ≤ 30, letters only
  • -10^9 ≤ value ≤ 10^9

Related concepts

Singleton Pattern

This early-access exercise uses standard input/output. More advanced concurrency challenges will use specialized class interfaces, instrumentation, and stress tests once the judging infrastructure is ready.

⌘ CodeC++17
GNU C++17 · main.cpp

Loading Monaco C++ editor…

Checking judge...

Checking whether the external C++ judge is available.

⌁ Test cases & resultsPublic samples: 1
Input
5
SET mode 3
GET mode
GET x
SET mode 4
GET mode
Expected output
3
NONE
4
Execution requires a secure external judge.