#B3774. Divergent Classifiers

    ID: 11433 Type: Default 1000ms 256MiB

Divergent Classifiers

Divergent Classifiers

In artificial intelligence, "classification" is a crucial task. For example, law enforcement systems use AI to classify potential telecom fraud and issue timely warnings. In this problem, we consider a simple linear binary classifier that is defined by (n) integer parameters (a_1,a_2,\dots,a_n). When given an input vector (x_1,x_2,\dots,x_n), the classifier outputs true if [ a_1\cdot x_1 + a_2\cdot x_2 + \dots + a_n\cdot x_n \le 0 ] and false otherwise. With good feature selection, even a simple linear classifier can deliver excellent results.

We are given two classifiers for the same task:

  • Classifier \(A\): outputs **true** if \(a_1\cdot x_1+a_2\cdot x_2+\dots+a_n\cdot x_n \le 0\) and **false** otherwise.
  • Classifier \(B\): outputs **true** if \(b_1\cdot x_1+b_2\cdot x_2+\dots+b_n\cdot x_n \le 0\) and **false** otherwise.

Since the two classifiers might disagree on some inputs (x), your task is to find an input vector (x=(x_1,x_2,\dots,x_n)) for which the two classifiers produce different results. In other words, find (x) such that

[ classify(a, x) \neq classify(b, x), ]

where the function classify is defined as follows:

bool classify(int param[], int x[]) {
    int y = 0;
    for (int i = 1; i <= n; i++) {
        y += param[i] * x[i];
    }
    return (y <= 0);
}

bool diverge(int x[]) {
    return classify(a, x) != classify(b, x);
}

Input/Output format:

The input consists of three lines:

  1. The first line contains a single integer \(n\), the number of parameters.
  2. The second line contains \(n\) space-separated integers representing the array \(a=[a_1,a_2,\dots,a_n]\).
  3. The third line contains \(n\) space-separated integers representing the array \(b=[b_1,b_2,\dots,b_n]\).

The output should be a single line with (n) space-separated integers (x_1,x_2,\dots,x_n) that cause the classifiers to output different results. It is guaranteed that for the given input there exists at least one solution.

inputFormat

The input consists of three lines:

  1. A single integer (n) denoting the number of parameters.
  2. (n) space-separated integers representing the coefficients (a_1,a_2,\dots,a_n).
  3. (n) space-separated integers representing the coefficients (b_1,b_2,\dots,b_n).

outputFormat

Output a single line containing (n) space-separated integers (x_1,x_2,\dots,x_n) such that the two classifiers yield different outputs. In other words, they must satisfy: [ classify(a,x) \neq classify(b,x). ] If there are multiple solutions, any one is acceptable.

sample

1
-1
1
1