Problem Solving/CodeForces

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #813 (Div. 2) B - Woeful Permutation

Problem - 1712B - Codeforces codeforces.com 유클리드 호제법이 아닌 패턴찾기 제목 Woeful Permutation 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 You are given a positive integer n. Find any permutation p of length n such that the sum lcm(1,p1)+lcm(2,p2)+…+lcm(n,pn) is as large as possible. Here lcm(x,y) denotes the least common multip..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #813 (Div. 2) A - Wonderful Permutation

Problem - 1712A - Codeforces codeforces.com 최대 최소 Swap 제목 Wonderful Permutation 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 You are given a permutation p1,p2,…,pn of length n and a positive integer k≤n. In one operation you can choose two indices i and j (1≤i> tc; while(tc--){ cin >> sz >> k; int *arr = new int[sz]; f..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #812 (Div. 2) B - Optimal Reduction

Problem - 1716B - Codeforces codeforces.com 제목 Optimal Reduction 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 Consider an array a of n positive integers. You may perform the following operation: select two indices l and r (1≤l≤r≤n), then decrease all elements al,al+1,…,ar by 1. Let's call f(a) the minimum number of ope..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #812 (Div. 2) A - Traveling Salesman Problem

Problem - 1716A - Codeforces codeforces.com 제목 Traveling Salesman Problem 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 You are living on an infinite plane with the Cartesian coordinate system on it. In one move you can go to any of the four adjacent points (left, right, up, down). More formally, if you are standing at ..

Problem Solving/CodeForces

[Codeforces/코드포스] Educational Codeforces Round 133 (Div. 2) B - Permutation Chain

Problem - 1716B - Codeforces codeforces.com 제목 Permutation Chain 조건 time limit per test : 2 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 A permutation of length n is a sequence of integers from 1 to n such that each integer appears in it exactly once. Let the fixedness of a permutation p be the number of fixed points in it — the number of positi..

Problem Solving/CodeForces

[Codeforces/코드포스] Educational Codeforces Round 133 (Div. 2) A - 2-3 Moves

Problem - 1716A - Codeforces codeforces.com 제목 2-3 Moves 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 You are standing at the point 0 on a coordinate line. Your goal is to reach the point n. In one minute, you can move by 2 or by 3 to the left or to the right (i.e., if your current coordinate is x, it can become x−3, x..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #811 (Div. 3) E - Add Modulo 10

Problem - 1714E - Codeforces codeforces.com 제목 Add Modulo 10 조건 time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output 문제 You are given an array of n integers a1,a2,…,an You can apply the following operation an arbitrary number of times: select an index i (1≤i≤n) and replace the value of the element ai with the value ai+(aimod10), where aimod10 ..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #811 (Div. 3) C - Minimum Varied Number

Problem - 1714C - Codeforces codeforces.com 제목 Minimum Varied Number 조건 time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output 문제 Find the minimum number with the given sum of digits s such that all digits in it are distinct (i.e. all digits are unique). For example, if s=20, then the answer is 389. This is the minimum number in which all digits ..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #811 (Div. 3) B - Remove Prefix

Problem - 1714B - Codeforces codeforces.com 제목 Remove Prefix 조건 time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output 문제 Polycarp was presented with some sequence of integers a of length n (1≤ai≤n). A sequence can make Polycarp happy only if it consists of different numbers (i.e. distinct numbers). In order to make his sequence like this, Polyc..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #811 (Div. 3) A - Everyone Loves to Sleep

Problem - 1714A - Codeforces codeforces.com 제목 Everyone Loves to Sleep 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 Vlad, like everyone else, loves to sleep very much. Every day Vlad has to do nn things, each at a certain time. For each of these things, he has an alarm clock set, the i-th of them is triggered on hi hou..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #582 (Div. 3) C - Book Reading

Problem - 1213C - Codeforces codeforces.com 1 ≤ N , M ≤ 10^16이므로 int → long long M의 일의 자리로 arr 결정 M = 1, arr = 1 2 3 4 5 6 7 8 9 0 M = 2, arr = 2 4 6 8 0 2 4 6 8 0 M = 3, arr = 3 6 9 2 5 8 1 4 7 0 M = 4, arr = 4 8 2 6 0 4 8 2 6 0 M = 5, arr = 5 0 5 0 5 0 5 0 5 0 M = 6, arr = 6 2 8 4 0 6 2 8 4 0 M = 7, arr = 7 4 1 8 5 2 9 6 3 0 M = 8, arr = 8 6 4 2 0 8 6 4 2 0 M = 9, arr = 9 8 7 6 5 4 3 2 1 0 N /..

Problem Solving/CodeForces

[Codeforces/코드포스] Codeforces Round #582 (Div. 3) B - Bad Prices

Problem - 1213B - Codeforces codeforces.com 시간초과 문제 뒤에서 부터 제일 작은 min값을 설정하여 앞으로 검색하면서 비교 제목 Bad Prices 조건 time limit per test : 1 second memory limit per test : 256 megabytes input : standard input output : standard output 문제 Polycarp analyzes the prices of the new berPhone. At his disposal are the prices for N last days: a1,a2,…,an, where ai is the price of berPhone on the day i. Polycarp consi..

JunHoChoi
'Problem Solving/CodeForces' 카테고리의 글 목록 (2 Page)