Discord

Checklist VsOSh AI 2026 Regional Stage, Tour 1 (mathematics) · H task

Lonely Circle

Russian title: Одинокий круг

Given points labelled ±1 that are separable by a circle, output any separating circle.

  • Algorithmic programming (circular separation, SVM motivation)
  • Russian original · English translation

The task

The statement introduces linear SVM classification with a scikit-learn code example, then poses an interview problem: points on the plane carry labels −1 and +1, and it is guaranteed that there is a circle with centre (x₀, y₀) and radius R > 0 such that all −1 points lie strictly inside it and all +1 points strictly outside.

Find any such circle.

Abridged and translated by SOTA from the official Russian materials. The official statement has the exact rules, and it wins wherever this summary differs.

In English

This task was published in Russian. SOTA translated its 3 files into English on 16 September 2026. Only the words changed in the notebooks: markdown, code comments, messages and printed output. The code, file names and paths are the original's, so a translated notebook runs with the original data.

Read the task statement in English 618 words

Lonely Circle

English translation by SOTA – AI Community of the Russian original. Organisers who would like this translation removed can email [email protected].

All-Russian School Olympiad in Informatics 2025–2026, Regional Stage, Grades 9–11
“Artificial Intelligence” profile, Tour 1, 17 January 2026
Task H

Points for the task: 50
Answer submission format: program code
Number of attempts: 100
Submission that counts: the last one
Time limit: 10 seconds
Memory limit: 64 MB
Input: standard input or input.txt
Output: standard output or output.txt

Statement

Andrey is preparing for an interview for a machine learning internship. To understand the basic ideas of classification, he started with the simplest case: if the points of two classes on the plane can be separated by a line, then the support vector machine (SVM) builds a separating line

w1x+w2y+b=0,w_1 x + w_2 y + b = 0,

and the sign of the expression w1x+w2y+bw_1 x + w_2 y + b determines which class a point belongs to (on one side of the line all points will have the sign ++, and on the other side, -).

This is how Andrey became acquainted with linear classification.

He found a simple code example that shows how to read points from standard input, write them into a table with the columns x, y, label, and train a linear SVM on this data:

import sys
import pandas as pd
from sklearn.svm import SVC

def read_points():
    data = []
    tokens = sys.stdin.read().split()
    it = iter(tokens)

    n = int(next(it))
    for _ in range(n):
        x = float(next(it))
        y = float(next(it))
        label = int(next(it))
        data.append((x, y, label))

    df = pd.DataFrame(data, columns=["x", "y", "label"])
    return df

df = read_points()

clf = SVC(kernel="linear")
clf.fit(df[["x", "y"]], df["label"])

w1, w2 = clf.coef_[0]
b = clf.intercept_[0]
print(w1, w2, b)

At the interview, however, Andrey was given a different task.

Points on the plane with class labels 1-1 and +1+1 are given. It is guaranteed that there exists a circle with centre (x0,y0)(x_0, y_0) and radius R>0R > 0 such that

  • all points of class 1-1 lie strictly inside this circle;
  • all points of class +1+1 lie strictly outside this circle.

You need to find any such circle (x0,y0,R)(x_0, y_0, R).

Help Andrey solve this problem and pass the interview!

Input format

The first line contains an integer nn (3n1053 \le n \le 10^5). Then nn lines follow, each with three real numbers xix_i, yiy_i, labelilabel_i: the coordinates of the next point and its label.

It is guaranteed that xi,yi109|x_i|, |y_i| \le 10^9.

Output format

Output three real numbers xx, yy and RR: the coordinates and the radius of the separating circle.

Scoring

Each test passed gives you 1 point.

The maximum possible score for the task is 50.

Test results are available during the tour.

Example

Input

10
0 0 -1
1 1 -1
2 0 -1
-2 0 -1
0 2 -1
4 0 1
-4 0 1
0 4 1
3 4 1
4 3 1

Output

0 0 3

Notes

This picture corresponds to the first example.

Orange points correspond to label=1label = -1, blue points correspond to label=1label = 1.

[Figure: the points of the example (label 1-1 as orange crosses, label 11 as blue dots) and the circle with centre (0,0)(0, 0) and radius 33 on a grid from 5-5 to 55; see page 12 of the original statement.]

Translated by SOTA. The Russian original is the official version and wins wherever the two differ. The figure for the example is not reproduced; see page 12 of the original PDF. If you organise this olympiad and would like the translation removed, email [email protected] and we will take it down.

At a glance

You get
Standard input (or input.txt): n (3 ≤ n ≤ 10⁵), then n lines x_i, y_i, label_i with |x_i|, |y_i| ≤ 10⁹.
You submit
Three real numbers x, y and R describing a separating circle.
Scoring
1 point per passed test, up to 50 points; test results visible during the tour; 100 attempts, the last one counts.
Rules
  • Program submission; time limit 10 s; memory limit 64 MB; output to standard output or output.txt.
Format
Regional stage, Tour 1, 17 January 2026; grades 9–11; individual; 300-minute tour (Moscow procedure); answers entered in Yandex Contest.

Details

Year
2026, Regional venues across Russia (in person)
Round
Regional Stage, Tour 1 (mathematics) · H task
Language
Russian; English translation by SOTA
License
Not stated by the source