#include <iostream> #include <algorithm> using namespace std; ; int a[maxn]; int main(){ int t; cin >> t; while(t--){ int n; cin >> n; string s; cin >> s; ; bool l = true; int i; ;i >= ;i -= ){ sum += *i+; if(l){ '){ a[i]…
我是铁牌选手 这次比赛非常得爆炸,可以说体验极差,是这辈子自己最脑残的事情之一. 天时,地利,人和一样没有,而且自己早早地就想好了甩锅的套路. 按理说不开K就不会这么惨了啊,而且自己也是毒,不知道段错误也可以是MLE,而且我的内存就是卡了那么一点点,在比赛紧张的状态下人也变傻了吧. 这次的题目难度是两边到中间一次递增的,但是我也不懂榜怎么会那样  A Peak Time Limit: 1 Second      Memory Limit: 65536 KB A sequence of  inte…
Doki Doki Literature Club Time Limit: 1 Second      Memory Limit: 65536 KB Doki Doki Literature Club! is a visual novel developed by Team Salvato. The protagonist is invited by his childhood friend, Sayori, to join their high school's literature club…
CONTINUE...? Time Limit: 1 Second      Memory Limit: 65536 KB      Special Judge DreamGrid has  classmates numbered from  to . Some of them are boys and the others are girls. Each classmate has some gems, and more specifically, the -th classmate has …
Peak Time Limit: 1 Second      Memory Limit: 65536 KB A sequence of  integers  is called a peak, if and only if there exists exactly one integer  such that , and  for all , and  for all . Given an integer sequence, please tell us if it's a peak or no…
Lucky 7 Time Limit: 1 Second      Memory Limit: 65536 KB BaoBao has just found a positive integer sequence  of length  from his left pocket and another positive integer  from his right pocket. As number 7 is BaoBao's favorite number, he considers a p…
King of Karaoke Time Limit: 1 Second      Memory Limit: 65536 KB It's Karaoke time! DreamGrid is performing the song Powder Snow in the game King of Karaoke. The song performed by DreamGrid can be considered as an integer sequence , and the standard…
Seven Segment Display Time Limit: 1 Second      Memory Limit: 65536 KB A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix d…
B题 思路 因为 \[ x=\sum\limits_{k=1}^{n}ka_k\\ y=\sum\limits_{k=1}^{n}ka_{k}^{2} \] 我们设交换前和交换后的这两个等式的值设为\(x_1,y_1,x_2,y_2\),现在我们开始愉快的推公式 \[ \begin{aligned} &x_1-x_2=(i-j)(a_i-a_j)&\\ &y_1-y_2=(i-j)(a_i^2-a_j^2)&\\ \Rightarrow &\frac{y1-y2}{…
Heap Partition Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge A sequence S = {s1, s2, ..., sn} is called heapable if there exists a binary tree T with n nodes such that every node is labelled with exactly one element from the se…
What Kind of Friends Are You? Time Limit: 1 Second      Memory Limit: 65536 KB Japari Park is a large zoo home to extant species, endangered species, extinct species, cryptids and some legendary creatures. Due to a mysterious substance known as Sands…
ZOJ 4024 Peak 题意 给出n和n个数,判断该数列是否是凸形的. 解题思路 从前往后第一对逆序数,和从后往前第一队逆序数,如果都非零而且相邻,证明该数组是凸形的. 代码 #include <cstdio> + ; int a[maxn]; int main() { int T; scanf("%d", &T); while(T--) { int n; scanf("%d", &n); ; i < n; i++) { sca…
对于没有题目积累和clever mind的我来说,想解这道题还是非常困难的,也根本没有想到用dp. from: http://blog.csdn.net/u013050857/article/details/45285515 #include <bits/stdc++.h> using namespace std; #define LL unsigned long long LL a[100010]; int main() { int n,m; scanf("%d",&am…
传送门 题意: 给出一个序列,你可以将任意一个数移到最前面: 求最少需要移动多少次,可以是此序列变成非递减序列: 思路: 定义 (ai,aj) 为逆序对 ( i < j , ai > aj ), 求出 aj 的最大值,用变量 curMax 存储: 遍历一遍数组,求解 ans: 对于∀ i ∈[1,n] ①如果 ai < curMax , ans++; ②如果 ai == curMax , 那么需要特殊判断: (2.1)如果 ai 之前不曾出现比 curMax 大的数,不需要移动: (2.…
传送门 题意要你构造一个序列,使得该序列的每个位置上的最长上升子序列的长度能构成给定的序列. 构造序列的元素要求还要求满足给定的上下界 solution 我们可以把给出的最长上升子序列的长度按升序排列,长度相同的按下标降序排列. 排完序后第一个数可以贪心的取其下界,同一层(即长度相同)的下标小的取值应该大于等于下标较大的取值 同时取值应该大于前一层下标最大且小于该位置的数 #define IN_LB() freopen("F:\\in.txt","r",stdin)…
ZOJ Problem Set - 3946 Highway Project Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the capital as fast as possible. Thus…
http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=392 E:Sequence in the Pocket 思路:从后往前判断在不在应该在的位置,如果不在则需要放到最前面,通过cnt控制当前的数 比较 排好序的数组的数. code: #include<bits/stdc++.h> using namespace std; #define LL long long #define INF 2000000000 #…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5503 The 12th Zhejiang Provincial Collegiate Programming Contest - K Capture the Flag Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge In computer security, Capture…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5496 The 12th Zhejiang Provincial Collegiate Programming Contest - D Beauty of Array Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward has an array A with N integers. He defines…
Floor Function Time Limit: 10 Seconds      Memory Limit: 65536 KB a, b, c and d are all positive integers which satisfy bc - ad > 0. Your task is to minimize the following function of a positive integer n. ⌊x⌋, the floor function, means the largest i…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5494 The 12th Zhejiang Provincial Collegiate Programming Contest - B Team Formation Time Limit: 3 Seconds      Memory Limit: 131072 KB For an upcoming programming contest, Edward, the…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5499 The 12th Zhejiang Provincial Collegiate Programming Contest - G Lunch Time Time Limit: 2 Seconds      Memory Limit: 65536 KB The 999th Zhejiang Provincial Collegiate Programming C…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5502  The 12th Zhejiang Provincial Collegiate Programming Contest - J Convert QWERTY to Dvorak Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, a poor copy typist, is a user o…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5500 The 12th Zhejiang Provincial Collegiate Programming Contest - H May Day Holiday Time Limit: 2 Seconds      Memory Limit: 65536 KB As a university advocating self-learning and work…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5504  The 12th Zhejiang Provincial Collegiate Programming Contest - L Demacia of the Ancients Time Limit: 2 Seconds      Memory Limit: 65536 KB There is a popular multiplayer online ba…
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5493 The 12th Zhejiang Provincial Collegiate Programming Contest - A Ace of Aces Time Limit: 2 Seconds      Memory Limit: 65536 KB There is a mysterious organization called Time-Space…
The 18th Zhejiang Provincial Collegiate Programming Contest GYM链接 https://codeforces.com/gym/103055 F 题意: 给定两个整数$n$和$m$,有两种操作: 当$n\geq 2$时,将$n$的值减少$1$…
  Ace of Aces Time Limit: 2 Seconds      Memory Limit: 65536 KB There is a mysterious organization called Time-Space Administrative Bureau (TSAB) in the deep universe that we humans have not discovered yet. This year, the TSAB decided to elect an out…
目录 A.JB Loves Math B.JB Loves Comma C. JB Wants to Earn Big Money G. Easy Glide I. Barbecue L. Candy Machine M. BpbBppbpBB 第一次体验省赛,加油! A.JB Loves Math JB is good at Math, so he thinks all the math problems in the world are easy. But one day, he meets…
Earthstone Keeper Time Limit: 4 Seconds      Memory Limit: 65536 KB Earthstone Keeper is a famous roguelike game created by Lizard Entertainment. In this game, an adventurer will explore in a single layer dungeon of N × M size. The adventurer starts…