Account
Draft saved on this device
▤ DescriptionOriginal CppValley problem
HFT SystemsEasy

Calculate Gross And Net Exposure

You receive N signed position exposures.

You receive N signed position exposures. Net exposure is the signed sum; gross exposure is the sum of absolute values. Print gross followed by net on one line. Use signed 64-bit arithmetic.

Input format

First line N; next line or lines contain N signed integers.

Output format

Print gross net separated by one space.

Examples

Example 1
Input
4
10 -5 7 -12
Expected output
34 0

Constraints

  • 0 ≤ N ≤ 100000
  • -10^9 ≤ exposure ≤ 10^9

Related concepts

Risk Management

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
4
10 -5 7 -12
Expected output
34 0
Execution requires a secure external judge.