← Back to Problems
The Impossible Characteristic Function
Medium standard Probability & Statistics
Time limit: 2 s per test  ·  Memory: 256 MB

You are given k candidate functions. For each one, decide whether it is the characteristic function of some real random variable — and when it is not, name the first reason why.

Each candidate is one of the following types, with parameters given as decimals:

  • RATIO a bphi(t) = (1 + a t^2) / (1 + b t^2), with 0.01 <= a, b <= 10.
  • DAMPCOS a bphi(t) = exp(-a t^2) * cos(b t), with 0.01 <= a <= 5, 0.1 <= b <= 20.
  • COSMIX w bphi(t) = 1 - w + w cos(b t), with 0.01 <= w <= 2, 0.1 <= b <= 20.
  • BUMP a bphi(t) = (1 + b) * max(0, 1 - |t| / a), with 0.1 <= a <= 10, 0 <= b <= 1.
  • GAUSSQ a cphi(t) = exp(-a t^2 - c t^4), with 0.01 <= a <= 1, 0 <= c <= 5.

Output

For each candidate, one line:

  • VALID — if the function is a characteristic function;
  • INVALID ZERO — if phi(0) != 1;
  • INVALID POINT — if phi(0) = 1 but |phi(t)| > 1 for some real t;
  • INVALID PSD — if phi(0) = 1 and |phi(t)| <= 1 everywhere, but the function is still not a characteristic function.

A candidate that is not a characteristic function may fail more than one of these conditions; report the first failing category in the order ZERO, POINT, PSD.

Input

The first line contains k (1 <= k <= 6). Each of the next k lines contains a type tag and its two parameters.

Scoring

This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.

Examples

input
3
RATIO 0.5 2
COSMIX 1.5 3
BUMP 2 0.25
output
VALID
INVALID POINT
INVALID ZERO
input
2
DAMPCOS 0.2 12
GAUSSQ 0.3 1.5
output
VALID
INVALID PSD
Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2