随笔分类 - codeforces
摘要:E. Selling Souvenirs time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output E. Selling Souvenir
阅读全文
摘要:Vasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the
阅读全文
摘要:Polycarp invited all his friends to the tea party to celebrate the holiday. He has ncups, one for each of his n friends, with volumes a1, a2, ..., an.
阅读全文
摘要:It's been almost a week since Polycarp couldn't get rid of insomnia. And as you may already know, one week in Berland lasts k days! When Polycarp went
阅读全文
摘要:You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have b
阅读全文
摘要:There are nn segments [li,ri][li,ri] for 1≤i≤n1≤i≤n. You should divide all segments into two non-empty groups in such way that there is no pair of seg
阅读全文
摘要:An accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented a
阅读全文
摘要:You are given qq queries in the following form: Given three integers lili, riri and didi, find minimum positive integer xixi such that it is divisible
阅读全文
摘要:Unlucky year in Berland is such a year that its number n can be represented as n = xa + yb, where a and b are non-negative integer numbers. For exampl
阅读全文
摘要:Pasha is participating in a contest on one well-known website. This time he wants to win the contest and will do anything to get to the first place! T
阅读全文
摘要:You are given an integer sequence 1,2,…,n1,2,…,n. You have to divide it into two sets AAand BB in such a way that each element belongs to exactly one
阅读全文
摘要:You are given a string ss consisting of exactly nn characters, and each character is either '0', '1' or '2'. Such strings are called ternary strings.
阅读全文
摘要:You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make
阅读全文
摘要:A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and goo
阅读全文
摘要:In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick. He is too selfish, s
阅读全文
摘要:Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You are given l and
阅读全文
摘要:The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non
阅读全文
摘要:C. Maximal GCD time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output C. Maximal GCD time limit
阅读全文
摘要:题目链接:https://vjudge.net/problem/CodeForces-803B#author=0 题意: 给你一个数组,其中至少包括一个0,求每一个元素距离最近一个0的距离是多少。 样例: Input 92 1 0 3 0 0 3 2 4 Input Output 2 1 0 1 0
阅读全文
摘要:题目链接 题意有点坑: 给你一个N*N的矩阵,让你填入K个1,使之整个矩阵关于左上到右下的对角线对称,并且这个要求这个矩阵的字典序最大。 对矩阵的字典序的定义是从每一行的第一个元素开始比较,大着为字典序较大。 思路: 根据字典序的定义贪心的从第一个元素开始走,如果没被填1,就填1并且关于对角线的对称
阅读全文

浙公网安备 33010602011771号