Problem J. Numbers Painting

Similar documents
Problem A: Optimal Array Multiplication Sequence

Problem A. Ascent Sequences

Problem A limit 1 second. Alphabet

B. Composing Of String

Quarterfinal Central region of Russia. Rybinsk, October

Dr. Relja Vulanovic Professor of Mathematics Kent State University at Stark c 2008

Error-Correcting Codes

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal.

Problem A: Collatz Conjecture

LESSON 1: INTRODUCTION TO COUNTING

Problem A. Pyramid of Unit Cubes

K Anup Kumar et al,int.j.comp.tech.appl,vol 3 (1), 32-39

NOWCODER.COM 牛客网 - 中国最大 IT 笔试 / 面试题库 一. 编程题

Beyond the Euler Trail. Mathematics is often thought of as formulas, ratios, and the number Pi. The history of

A Problem Set 8: Geometry Spring 2018

Millionaire. Input. Output. Problem limit seconds

Problem Solving Strategies set of advanced problems

Problem A. Find a Number

4 ' MATHCOUNTS National Competition Sprint Round Problems 1-30 DO NOT BEGIN UNTIL YOU ARE INSTRUCTED TO DO SO.

Shuli s Math Problem Solving Column

PLU February 2018 Programming Contest. Novice Division

Problem A A New Alphabet

2016 ACM ICPC Southeast USA Regional Programming Contest. Division 1

2016 靜宜大學全國程式競賽題目. Problem1:Largest Square. Description

ACM International Collegiate Programming Contest 2013

Problems Overview. The 2015 Asia ACM-ICPC Hanoi Regional Contest. Note: The input and output for all the problems are standard input and output.

A. Petr and a calendar

NOWCODER.COM 牛客网 - 中国最大 IT 笔试 / 面试题库 一. 编程题

2 Sets. 2.1 Notation. last edited January 26, 2016

Combinatorics: The Fine Art of Counting

Output: For each size provided as input, a figure of that size is to appear, followed by a blank line.

Spring 2017 #5 A. Two Buttons

Problem A. Character Encoding

Anti Brute Force Lock

Problem A As Easy as CAB

XV Open Cup named after E.V. Pankratiev Stage 6, Grand Prix of Japan, Sunday, February 1, 2015

Fractions with a denominator of 10, 100 or can be written as decimals. A decimal is any number which has a decimal comma.

Testing Isomorphism of Strongly Regular Graphs

Pacific Northwest Region Programming Contest Division 2

PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS

There system is working in base 8 and thus in order to interpret their numbers to decimal system each item is a place value to the power 8.

Lecture 7: Counting classes

In this section we take an aside from the normal discussion in algebra.

BEOWULF STUDY GUIDE PART 3 LANGUAGE ARTS 4 COLLEGE PREP MUNSELL 84 POINTS POSSIBLE

COCI 2016/2017. Tasks. Round #3, November 26th, Task Time limit Memory limit Score. Imena 1 s 32 MB 50. Pohlepko 1 s 64 MB 80

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

CROATIAN OPEN COMPETITION IN INFORMATICS. 5 th ROUND

Section 26: Associativity and Order of Operations

GNU OCTAVE BEGINNER'S GUIDE BY JESPER SCHMIDT HANSEN DOWNLOAD EBOOK : GNU OCTAVE BEGINNER'S GUIDE BY JESPER SCHMIDT HANSEN PDF

CS 161 Computer Security

Major Assignment: Pacman Game

Databases vs. Spreadsheets

Objective: Construct a coordinate system on a plane.

Chapter 0, Pre-Algebra from Beginning and Intermediate Algebra by Tyler Wallace is available under a Creative Commons Attribution 3.

Using Scopus. Scopus. To access Scopus, go to the Article Databases tab on the library home page and browse by title.

Operating Systems. Deadlock. User OS. Kernel & Device Drivers. Interface Programs. Brian Mitchell - Operating Systems

If Statements, For Loops, Functions

ECE Lesson Plan - Class 1 Fall, 2001

Introduction to Modern Cryptography. Benny Chor

The second statement selects character number 1 from and assigns it to.

Notes for Lecture 24

XVIII Open Cup named after E.V. Pankratiev Stage 1: Grand Prix of Romania, Sunday, September 17, 2017

Greedy Homework Problems

How invariants help writing loops Author: Sander Kooijmans Document version: 1.0

Problem A. Alice the Fan

CS2 Practical 1 CS2A 22/09/2004

Problem A - Let s start the contest

Fundamentals of Operations Research. Prof. G. Srinivasan. Department of Management Studies. Indian Institute of Technology, Madras. Lecture No.

RIEGL LMS-Q780. The Versatile, High Altitude Airborne LIDAR Sensor

Graph Theory II. Po-Shen Loh. June edges each. Solution: Spread the n vertices around a circle. Take parallel classes.

Assignment #1 Simple C++

Central Europe Regional Contest

Overview On Methods Of Searching The Web

Pacific Northwest Region Programming Contest Division 2

When using computers, it should have a minimum number of easily identifiable states.

The Ultimate Guide To Using Your Android Smart Phone PDF

Problem Y A limit 1 second. Zigzag

Summer 2013 Modules 9-13

Generating Test Data with Enhanced Context Free Grammars

Understanding Geospatial Data Models

COMP3121/3821/9101/ s1 Assignment 1

Graph Theory for Modelling a Survey Questionnaire Pierpaolo Massoli, ISTAT via Adolfo Ravà 150, Roma, Italy

UCF Practice Local Contest Aug 23, 2014

High speed imaging with an Agfa consumer grade digital camera

ACM ICPC Bolivia Programming Contest Cuarto On-Line. Set de Problemas. Domingo 30 de Mayo del 2010

Weighted Powers Ranking Method

COUNTING PERFECT MATCHINGS

Use of Synthetic Data in Testing Administrative Records Systems

c) How many students took none of the three subjects?

Topic 3: Fractions. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra

RIEGL LMS-Q780. The Versatile, High Altitude Airborne LIDAR Sensor

Data Management Page 1 of 12 Permutations Extra Problems (solutions)

2015 ICPC. Northeast North America Preliminary

Accelerated Math. Class work 1. Algebra. 1. Can you compare Compute by the most convenient way:

Knowing how to use white space can be an effective tool in your design arsenal.

following determine whether it is an element, subset or neither of A and

Math 4. Class work 2. Algebra. Sets.

Problem A Moogle. source: moogle.c or moogle.cpp or moogle.java

THE MAGIC OF A MILLION DOLLARS BY MAIL!

Maximum Density Still Life

Transcription:

Problem J. Numbers Painting file: file: Dr. Vasechkin wants to paint all numbers from 1 to N in such a way that if number A is divisible by number B, numbersa and B have di erent colors. Help Dr. Vasechkin to find such a painting, where the number of the colors used is minimal. The input contains integer number N (1 apple N apple 10 000). Write the number of the colors M in the desired painting in the first line of the output. In the second line of the output write the desired painting of numbers from 1 to N. The used colors should be represented by numbers from 1 to M. If there are several solutions, choose any of them. A 12 4 1 2 2 3 2 3 2 4 3 3 2 4

Problem B. Join the Strings file: file: His Royal Highness King of Berland Berl XV was a very wise man and had a very accomplished wife, who was aware of the fact, that prominent and outstanding personalities once having written down their names on the pages of glorious History, remain there forever. His Royal Highness King Berl XV experienced an intrinsic, lost nowadays, deep and sincere sense of respect and trust for his beloved spouse. So he decided to acquire a chronicler of his own. Due to the ambiguous nature of misunderstanding and the crying injustice of history to ambiguity, he decided to leave all his royal responsibilities aside and made up his royal mind to find the chronicler, who will make him famous, depicting all his heroic deeds truthfully and gloriously enough. The King assembled the greatest minds of his kingdom at the Academic Chroniclers Meeting (ACM), as he named it, and decided to test their might. The task was to build the Smallest Lexicographical Concatenation (SLC) out of the given N strings. SLC of N strings s 1,...,s N is the lexicographically smallest their concatenation s i1 +...+ s in,wherei 1,...,i N is a permutation of integers from 1 through N. It s a great privilege to be a chronicler, so don t miss your chance and don t screw it up! Make the king choose you! The first line of the input file contains a single integer N (1 apple N apple 100) indicating the number of strings. The following N lines contain N strings, one string per line. The length of each string is no more than 100 characters. Each string consists only of lowercase Latin letters. There are no any leading or trailing spaces. Print the SLC of the given N strings to the output file as a single line. 6 it looks like an easy problem aneasyitlikelooksproblem

Problem L. Remote Control file: file: A couple of years ago Peter Berlandin bought a brand new Berlony TV set. The TV set supports 100 channels, numbered from 0 to 99. The remote control of the TV set has 13 buttons: 1 2 3 " 4 5 6 # 7 8 9 -- 0 When pressing the button " the number of the current channel increases by 1 (if the current channel is the 99th, it switches to 0). If you press the button # the number of the current channel decreases by 1 (if the number of the current channel is 0, it switches to the 99th). Switching to the channel from 0 to 9 can be done by pressing the button at the remote control with the corresponding number. Switching to the channel from 10 to 99 can be done by pressing the -- button followed by two buttons in accordance with the number of the channel required. Casual handling and time don t do good to any of us! Finally the remote control was damaged and went out of order. Now some of the buttons are not functioning. Your task is to switch from X channel to Y using the minimum number of clicks. The first 4 lines contain information about the productivity of every button at the remote control. 0 stands for the broken button and 1 stands for the one that is functioning. The first line describes 1, 2, 3 and " buttons accordingly. The second line describes 4, 5, 6 and # buttons accordingly. The third line describes 7, 8 and 9 buttons accordingly. The fourth line describes -- and 0 buttons accordingly. The fifth line describes X and Y. Print the answer to the problem the minimum number of clicks to switch from X to Y in the output file. Print 1 if it is impossible to switch from X to Y. s 1 1 1 1 1 1 1 1 1 1 1 1 1 23 52 0 0 1 1 1 1 1 1 1 1 1 1 1 23 52 C 3 4

Problem I. Just Matrix file: file: This task is not about Berland or Beerland troubles, roads or flights. There will be no boring coins. This task is about simple square matrix. Numbers from 1 to n 2 were written down in n n square matrix A. Each number was written exactly once. After that for each number the pair top i,j and left i,j was written. top i,j is the number of elements in column j bigger than A i,j and positioned to the top from A i,j. left i,j is the number of elements in the row i bigger than A i,j and positioned to the left from A i,j. You are given matrices top and left. Your task is to find any possible matrix A fulfilling the requirements of the problem. The first line of the input contains integer number n (1 apple n apple 600). Further matrices top and left are written, each in the form of n lines of n non-negative integer numbers. The matrices are separated by the empty line. Numbers in both matrices are not bigger than n. Write to the output matrix A in the format similar to the input data. If there are several solutions, you can choose any of them. If there is no solution, write to the output just one number 0. 3 0 0 0 0 0 0 0 0 2 0 0 0 0 1 0 0 1 2 D 1 2 6 5 3 7 9 8 4

Problem E. XOR-omania file: file: Professor Vasechkin had a notebook with an outstanding set of non-negative integers A 1,A 2,...,A n. Somehow the most remarkable fact that made this set so outstanding appeared to be the impossibility to find such a subset of two or more elements, that XOR of elements in the subset would equal to zero. One day the professor managed to create a new set of integers B 1,B 2,...,B n(n 1)/2 through applying the XOR operations to all pairs of elements of A set. The set B was not written in any particular order. Unfortunately due to his natural absent-mindedness professor lost the A set and now he is very confused but still obliged to ask you of a considerable favor. Please restore the set in accordance with the remaining B set. The first line describes M the amount of numbers in B set (1 apple M apple 100, M = N (N 1)/2 for some number N). The second line describes M numbers B 1,B 2,...,B M (0 apple B i apple 2 31 1). Print the A set in one line through a blank. All elements of A should be from 0 to 2 31 1 inclusively. If there are several solutions of the problem, you can choose any of them. It is guaranteed that there exists at least one A set that satisfies the condition. 6 30 19 66 13 92 81 94 64 77 28

Problem D. Wolves and Sheep file: file: The herds of Berland are in danger! Wolves have attacked a pasture of sheep. The shepherd has decided to exterminate wolves in the neighborhood without causing any damage to the sheep. Thus he took a trophy gun, left to him by his grandfather and headed for the ambush. The gun is cast steel and fires with the armour-piercing shells, and the bullets go right through and can hurt a sheep if a wolf is being shot. The wolves and the sheep are represented by segments. The shepherd is in point (0, 0). The flying path of a bullet is a ray coming from point (0, 0). If the path and the segment, characterizing an animal, intersect the animal dies. Please find the minimum of shots, that is necessary, to kill all the wolves. We rely upon your prudence, for every sheep should remain safe and sound. The first line describes two integers N and M (0 apple N apple 10 5 ;0appleM apple 10 5 ) is the amount of the wolves and the sheep accordingly. It is followed by N +M lines. Every line contains four integer numbers X 1,Y 1,X 2,Y 2 ( 1000 apple X 1,X 2 apple 1000; 1 apple Y 1,Y 2 apple 1000), describing the segments. The first N lines describe the disposition of the wolves, the following M lines reveal the situation with the sheep. Segments can degenerate to points. Print the minimum amount of shots required to kill all the wolves. If you find this request quite impossible to fulfill without killing a single sheep, enter No solution (no quotation marks). s 1 1 5 5 6 7 3 5 8 5 F 2 1 1 1 2 3-5 4 2 2 999 1000 1000 999 No solution 1