Shopping 题目连接: http://codeforces.com/gym/100803/attachments Description Your friend will enjoy shopping. She will walk through a mall along a straight street, where N individual shops (numbered from 1 to N) are aligned at regular intervals. Each shop…
A Knight 留坑. B Tree 思路:两次树形DP,但是要考虑0没有逆元 可以用前缀后缀做 #include <bits/stdc++.h> using namespace std; #define N 1000010 #define ll long long ; int n; ll dp[N], dp2[N]; ll prefix[N], suffix[N]; vector <int> G[N]; void Init() { ; i <= n; ++i)…
#include <bits/stdc++.h> using namespace std; ; int fa[maxn]; int main(){ int n, m; scanf("%d%d", &n, &m); ; i <= n+; i++) fa[i] = i; ; i <= m; i++){ int x, y; scanf("%d%d", &x, &y); fa[x] = max(fa[x], y); }…
D. Queue time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For e…
D. Fedor and coupons time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output All our characters have hobbies. The same is true for Fedor. He enjoys shopping in the neighboring supermarket. The goo…