1/23/25, 7:29 PM Problem - 2041C - Codeforces
|
stdfloat | Logout
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN
PROBLEMS SUBMIT STATUS STANDINGS CUSTOM TEST
2024 ICPC Asia Taichung Regional
C. Cube Contest (Unrated, Online Mirror, ICPC
Rules, Preferably Teams)
time limit per test: 3 seconds
Finished
memory limit per test: 1024 megabytes
Practice
→ Virtual participation
Virtual contest is a way to take part in past contest,
as close as possible to participation on time. It is
supported only ICPC mode for virtual contests. If
you've seen these problems, a virtual contest is not
for you - solve these problems in the archive. If you
just want to solve some problem from a contest, a
virtual contest is not for you - solve this problem in
the archive. Never use someone else's code, read
the tutorials or communicate with other person
during a virtual contest.
Start virtual contest
You are given an n × n × n big three-dimensional cube that contains n3 numbers. You have to
choose n of those numbers so that their sum is as small as possible. It is, however, forbidden to
choose two numbers that are located in the same plane. That is, if we identify the positions in the
→ Clone Contest to Mashup
cube by three Cartesian coordinates, then choosing two numbers from positions (x, y, z) and
(x , y , z ) is forbidden if x = x , y = y , or z = z .
′ ′ ′ ′ ′ ′ → Submit?
Input Language: GNU G++20 13.2 (64 bit, winlibs)
The input consists of the number n followed by n3 numbers in the cube. The numbers are
Choose
presented as n two-dimensional matrices, one for each layer of the cube. More precisely, there file:
Choose File No file chosen
will be n lines follow, each having n numbers. For each x, y, z (1 ≤ x, y, z ≤ n), the number
2
at the position (x, y, z) is listed as the z-th number in the ((x − 1) × n + y)-th line. Submit
2 ≤ n ≤ 12
7
All numbers in the cube are integers between 0 and 2 × 10 . → Contest materials
Output Announcement (en)
The output consists of a single number. It is the minimum sum of n numbers chosen from the
Statements (PDF) (en)
cube according to the above rules.
Tutorial (en)
Example
input Copy
3
1 2 3
4 5 6
7 8 9
1 1 1
2 2 2
3 3 3
4 3 0
2 1 4
9 8 9
output Copy
Codeforces (c) Copyright 2010-2025 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Jan/23/2025 11:27:49UTC+5 (i2).
Desktop version, switch to mobile version.
Privacy Policy
Supported by
[Link] 1/2
1/23/25, 7:29 PM Problem - 2041C - Codeforces
[Link] 2/2