原文链接http://www.cnblogs.com/zhouzhendong/p/8934377.html 题目传送门 - ARC080 E - Young Maids 题意 给定一个长度为$n$的序列$p$,$p$为$1\cdots n$的一个排列. 现在让你每次取出序列$p$的相邻两个,然后把他们按照原来的顺序放进序列$q$的最前面.注意每次这样的操作之后,$p$序列的剩余两半都会合并起来. 不断进行上述操作,直到$p$为空. 最小化序列$q$的字典序,并输出序列$q$. $n\leq 2…
题目传送门:F - Operations on a Matrix (atcoder.jp) 题意: 给一个N*M大小的零矩阵,以及Q次操作.操作1(l,r,x):对于 [l,r] 区间内的每列都加上x:操作2(i,x):对于第 i 行,替换为x:操作3(i,j):查询矩阵第 i 行,第 j 列元素的值. N.M.Q大小均为2E5. 思路:树状数组 首先考虑没有操作2的情况,那么很容易地就可以用树状数组实现对列的区间加及单点查询. 当有操作2时,对于操作3的查询:将该行最后一次操作2的行修改值记作…
Young Maids Time Limit: 50 Sec  Memory Limit: 512 MB Description 给定一个排列,每次选出相邻的两个放在队头,要求字典序最小. Input 第一行一个整数n,第二行n个数表示这个排列. Output n个数表示答案. Sample Input 8 4 6 3 2 8 5 7 1 Sample Output 3 1 2 7 4 6 8 5 HINT n%2=0,2 <= n <= 2e5 Solution 倒着考虑. 我们维护一个小根…
A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E869120's and square1001's 16-th birthday is coming soon.Takahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces. E869…
没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder Beginner Contest 052 A题意: 输出大的面积? 思路: max(A*B,C*D); AtCoder Beginner Contest 052 B题意: 枚举过程,然后...太水了.. AtCoder Beginner Contest 052 C题意: 输出N!的因子个数mod1…
A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) oth…
AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b; cin >> a >> b; cout &…
AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) \[x=i,g(x)=0\] \[x\ne i ,g(x)=1\] 则我们可以构造 \[f(x)=\sum^{i=0}_{P-1}(-a_i*(x-i)^{P-1}+a_i)\] 对于第\(i\)条式子当且仅当\(a_i=1 \ and \ x=i\)时取到\(1\) 代码写的比较奇怪 const…
A - Rating Goal Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Takahashi is a user of a site that hosts programming contests.When a user competes in a contest, the rating of the user (not necessarily an integer) changes…
AtCoder Beginner Contest 079 D - Wall Warshall Floyd 最短路....先枚举 k #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ][]; int H, W, A, ans; int main() { scanf("%d%d", &H, &a…