目录 Contest Info Solutions A. Attack B. Polynomial E. Interesting Trip F. Sequence G. Winner H. Another Sequence I. Hamster Sort J. Prefix K. A Good Game Contest Info Practice Link Solved A B C D E F G H I J K 9/11 O O - - Ø O Ø O Ø O O O 在比赛中通过 Ø 赛后通…
比赛链接https://www.jisuanke.com/contest/3098?view=challenges B题 拉格朗日插值 题意  T组输入.一个n次多项式 f(x) ,每项的系数不知道,只知道f(0),f(1)..f(n) 的值,m个询问,L,R.计算$\sum_{i=L}^{R}f(i)\quad mod(9999991)$ $(1\leq T\leq 5) $ $(1\leq n\leq 1000) $ $(1\leq m\leq 2000) $ $(1\leq L\leq R…
题意:给你一个长度为$n$的数组,定义函数$f(l,r)=a_{l} \oplus a_{l+1} \oplus...\oplus a_{r}$,$F(l,r)=f(l,l)\oplus f(l,l+1)\oplus ...\oplus f(l,r)\oplus f(l+1,l+1)\oplus ...f(l+1,r)\oplus ...\oplus f(r,r)$,有两种操作,第一种将数组中某个元素$a[x]$变为$y$,第二种计算$F(l,r)$的值. 思路:打表后发现只有当$l$和$r$同…
打网络赛 比赛前的准备工作要做好 确保 c++/java/python的编译器能用 打好模板,放在桌面 A. PERFECT NUMBER PROBLEM #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <algorithm> #include <set> #include…
The Preliminary Contest for ICPC China Nanchang National Invitational 题目一览表 考察知识点 I. Max answer 单调栈+暴力?? J. Distance on the tree 树链剖分 M. Subsequence 思维??…
Distance on the tree DSM(Data Structure Master) once learned about tree when he was preparing for NOIP(National Olympiad in Informatics in Provinces) in Senior High School. So when in Data Structure Class in College, he is always absent-minded about…
A. PERFECT NUMBER PROBLEM 题目链接:https://nanti.jisuanke.com/t/38220 题意: 输出前五个完美数 分析: 签到.直接百度完美数输出即可 #include<bits/stdc++.h> #define ios std::ios::sync_with_stdio(false) , std::cin.tie(0) , std::cout.tie(0) #define sd(n) scanf("%d",&n) #d…
题目链接:https://nanti.jisuanke.com/t/38223 题意:有一堆火柴构成了一个加减法式子,你可以把火柴重新组合,要求数字个数和原来一样多,每个数字的位数和对应原数字位数一样多,总火柴数量也一样多,要求你构造新的式子算出来的结果最大. 思路:我们用dp[i][j]表示前i个数 用了j根火柴 所能达到的最大值 为此我们需要先预处理两个数组 mx[i][j] mn[i][j] 分别表示 i位数用了j根火柴的最大值/最小值 于是对于dp方程 我们可以得出 dp[i][j]=m…
题目链接:https://nanti.jisuanke.com/t/38228 题目大意:一个区间的值等于该区间的和乘以区间的最小值.给出一个含有n个数的序列(序列的值有正有负),找到该序列的区间最大值. 样例输入: 5 1 2 3 4 5 样例输出: 36 解题思路:如果序列的值全部为正值的话,可以说很简单,用一个单调栈加前缀和就可以了直接a.但是区间中存在负值,这个问题就变得复杂多了. 首先我们可以用两次单调栈,在O(n)的时间内,对于每个a[i]找到一个最大区间[ l[i] , r[i]…
Alice has a magic array. She suggests that the value of a interval is equal to the sum of the values in the interval, multiplied by the smallest value in the interval. Now she is planning to find the max value of the intervals in her array. Can you h…
Alice has a magic array. She suggests that the value of a interval is equal to the sum of the values in the interval, multiplied by the smallest value in the interval. Now she is planning to find the max value of the intervals in her array. Can you h…
题面 题意:一个5e5的数组,定义一个区间的值为 这个区间的和*这个区间的最小值,注意数组值有负数有正数,求所有区间中最大的值 题解:如果全是正数,那就是原题 POJ2796 单调栈做一下就ok 我们现在有负数,考虑这段区间,他的和必须是负数,由于导致和为负数,最小值一定也是负数, 那对于这样一个和为负的区间进行扩展的时候,遇见下一个数,是负数,我们一定会扩展,无论这个负数大小 遇见下一个是正数,如果和没有变正,那就可以继续扩展下去(不更新答案罢了) 所以我们对于那些和为负的区间,单独统计一下答…
Max answer Alice has a magic array. She suggests that the value of a interval is equal to the sum of the values in the interval, multiplied by the smallest value in the interval. Now she is planning to find the max value of the intervals in her array…
目录 Contest Info Solutions A. PERFECT NUMBER PROBLEM D. Match Stick Game G. tsy's number H. Coloring Game' I. Max answer J. Distance on the tree K. MORE XOR M. Subsequence Contest Info Practice Link Solved A B C D E F G H I J K L M 8/13 O - - O - - O…
We call a string as a 0689-string if this string only consists of digits '0', '6', '8' and '9'. Given a 0689-string $s$ of length $n$, one must do the following operation exactly once: select a non-empty substring of $s$ and rotate it 180 degrees. Mo…
BaoBao has just found a grid with $n$ rows and $m$ columns in his left pocket, where the cell in the $j$-th column of the $i$-th row (indicated by $(i, j)$) contains an arrow (pointing either upwards, downwards, leftwards or rightwards) and an intege…
题意: 给定一个二进制表示的n,让你找满足如下要求的数对(i,j)的个数 $0 \leqslant j \leqslant i \leqslant n$ $ i & n = i $ $ i & j = 0 $ 其中&代表按位与 题解: 打表发现对于单个i满足上述规律的j的数量为$2^{(num \ of \ 0 \ in(i)_2)}$ 因此对着n的二进制可以从后往前dp计算每一位能够贡献出多少个i,这些i能够贡献出多少0 #include <algorithm> #i…
题意: 给你n个盘子,这n个盘子里面分别装着1!到n!重量的食物,对于每一个询问k,找出一个最短的区间,使得区间和 mod 998857459 大于或等于k 盘子数量 n<=1e5 询问次数 m<=1e4 题解: 坑点在于此题模数998857459=4*773*2803 是个合数,因此任何a>=2803 a!=0 因此,只需考虑非0的盘子作为端点,暴力枚举$(max(n,2802))^2$个区间. 我使用的方式是记录阶乘取模非0节点的值和位置,然后求前缀和 再枚举左右端点,记录区间和取模…
A .Architecture 题意:其实就是想让你找到两行数的最大值,然后比较是否相同,如果相同输出'possible',不同则输出'impossible' 思路:直接遍历寻找最大值,然后比较即可 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cmath> 5 using namespace std; 6 int a[100],b[100]; 7 int m…
2019 ICPC 南昌网络赛 比赛时间:2019.9.8 比赛链接:The 2019 Asia Nanchang First Round Online Programming Contest 总结 // 史上排名最高一次,开场不到两小时队友各A一题加水题共四题,排名瞬间升至三四十名 // 然后后三小时就自闭了,一题都没有突破...最后排名211 hhhh     B. Fire-Fighting Hero 题意 队友做的,待补.   AC代码 #include<cstdio> #includ…
目录 ACM ICPC China final G Pandaria ACM ICPC China final G Pandaria 题意:给一张\(n\)个点\(m\)条边的无向图,\(c[i]\)代表点\(i\)的颜色,每条边有一个权值 现在有q个询问如下 u w代表从点u出发,每次只能走权值不超过w的边,经过的颜色中次数最多的是哪种颜色,若有多种,输出编号最小的. $ 1<=n<=1e5$ $ 1<=m,q<=2e5$ $ 1<=c_i<=n$ $ 1<=w…
Tree Ming and Hong are playing a simple game called nim game. They have nn piles of stones numbered 11 to nn ,the ii-th pile of stones has a_iai​ stones. There are n - 1n−1 bidirectional roads in total. For any two piles, there is a unique path from…
2019 ICPC Asia Nanjing Regional A - Hard Problem 计蒜客 - 42395 若 n = 10,可以先取:6,7,8,9,10.然后随便从1,2,3,4,5里面选一个都肯定符合题意 若 n = 9,可以先取:5,6,7,8,9,然后随便从1,2,3,4里面选一个都肯定符合题意. 所以答案就是后半部分的数量+1 #include <cstdio> #include <iostream> #include <cmath> #inc…
Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 429    Accepted Submission(s): 244 Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed in a…
Game Rooms Time Limit: 4000/4000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submit Status Your company has just constructed a new skyscraper, but you just noticed a terrible problem: there is only space to put one game room on each…
题目来源 The 2018 ACM-ICPC China JiangSu Provincial Programming Contest 35.4% 1000ms 65536K Persona5 Persona5 is a famous video game. In the game, you are going to build relationship with your friends. You have N friends and each friends have his upper b…
NAIPC 2017 Yin and Yang Stones 75.39% 1000ms 262144K   A mysterious circular arrangement of black stones and white stones has appeared. Ming has been tasked with balancing the stones so that only one black and one white stone remain. Ming has two ope…
2016 China Collegiate Programming Contest Final Table of Contents 2016 China Collegiate Programming Contest FinalProblem A:Problem J:Problem H: Problem A: 题意:喝咖啡,每三杯就又可以有免费一杯,求最少花费: 分析:贪心: #include <bits/stdc++.h> using namespace std; const int inf…
Let's consider some math problems. JSZKC has a set A=A={1,2,...,N}. He defines a subset of A as 'Meo set' if there doesn't exist two integers in this subset with difference one. For example, When A={1,2,3},{1},{2},{3},{1,3} are 'Meo set'. For each 'M…
JSZKC is going to spend his vacation! His vacation has N days. Each day, he can choose a T-shirt to wear. Obviously, he doesn't want to wear a singer color T-shirt since others will consider he has worn one T-shirt all the time. To avoid this problem…