0% found this document useful (0 votes)
10 views

Problem - 1895D - Codeforces

The document describes a programming problem from Codeforces, specifically Problem 1895D, which involves constructing an array of integers based on given constraints. The task is to create an array where each integer from 0 to n-1 appears exactly once and the XOR of consecutive elements equals specified values. The input includes the number of elements and the XOR values, with the output being the constructed array.

Uploaded by

Yhlas Yklymow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Problem - 1895D - Codeforces

The document describes a programming problem from Codeforces, specifically Problem 1895D, which involves constructing an array of integers based on given constraints. The task is to create an array where each integer from 0 to n-1 appears exactly once and the XOR of consecutive elements equals specified values. The input includes the number of elements and the XOR values, with the output being the constructed array.

Uploaded by

Yhlas Yklymow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

5/22/24, 12:02 PM Problem - 1895D - Codeforces

|
stdfloat | Logout

HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP

PROBLEMS SUBMIT STATUS STANDINGS CUSTOM TEST

Educational Codeforces Round 157


D. XOR Construction (Rated for Div. 2)
Finished
time limit per test: 2 seconds
memory limit per test: 512 megabytes Practice
input: standard input
output: standard output

You are given n − 1 integers a1 , a2 , … , an−1 .


→ Virtual participation 
Your task is to construct an array b1 , b2 , … , bn such that:

every integer from 0 to n − 1 appears in b exactly once; → Clone Contest to Mashup 


for every i from 1 to n − 1, bi ⊕ bi+1 = ai (where ⊕ denotes the bitwise XOR
operator). → Submit?

Input
Language: GNU G++20 13.2 (64 bit, winlibs)
The first line contains one integer n (2 ≤ n ≤ 2 ⋅ 105 ).
Choose
Choose File No file chosen
The second line contains n − 1 integers a1 , a2 , … , an−1 (0 ≤ ai ≤ 2n). file:

Additional constraint on the input: it's always possible to construct at least one valid array b Submit

from the given sequence a.

Output → Contest materials


Print n integers b1 , b2 , … , bn . If there are multiple such arrays, you may print any of them.
Announcement
Examples
Tutorial
input Copy

4
2 1 2

output Copy

0 2 3 1

input Copy

6
1 6 1 4 1

output Copy

2 3 5 4 0 1

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov


The only programming contests Web 2.0 platform
Server time: May/22/2024 12:00:59UTC+5 (l1).
Desktop version, switch to mobile version.
Privacy Policy

Supported by

https://mirror.codeforces.com/problemset/problem/1895/D 1/1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy