Gym 101810】的更多相关文章

题目:https://codeforc.es/gym/101810/problem/M 题意:给 你一颗树,下面有m次查询,求u->v的最大值是多少,输入两点之间都会有两条边,正边有正权,反边有反权,然后问u->v可以经过的最大权值是多少 思路:我们首先以u为根我们会发现我们走非v所在子树时我们都可以把所有边走完并且回来,对于v所在子树我们也可以把正反两条边都走完,u-v的最短的那条路只能走一遍,所以这个问题就转化为了求最长链问题,u->v的最长链,但是我们有m次查询,我们不可能每次取遍…
友情提示: 这篇题解并没有GJKL,因为我也不会,而且看别人代码也看不懂,而且问学长还不给我讲!hmc:这个题巨麻烦,我只能说balabala.我不学了我退役了啊! A:这傻逼题我从开头wa了四个小时然后我发现我写了各种奇葩东西, 嗯不说了.很明显要么在某线段起点开始要么在某线段终点结束.然后枚举段点二分就行. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; struct Node{ ll l,r,v;…
bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #define ll long long const int MAXN=1010; int a[MAXN<<1]; int main() { int t; cin>>t; int n; while(t--) { cin>>n; for(int i=1;i<=2*n;i++)…
bryce1010模板 http://codeforces.com/gym/101810 #include<bits/stdc++.h> using namespace std; #define ll long long ll a[1000005]; int main() { int t,n,temp; ll ans,maxn,minl,x; scanf("%d",&t); while(t--) { scanf("%I64d",&n);…
bryce1010模板 http://codeforces.com/gym/101810 #include<bits/stdc++.h> using namespace std; #define ll long long const ll maxn = 1e5 + 5; const ll mod = 1e9+7; ll n; ll p[maxn]; ll vis[maxn]; int main() { ll t; scanf("%lld",&t); ll pre;…
bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #define ll long long int main() { int t; scanf("%d",&t); ll n,m; while(t--) { scanf("%lld%lld",&n,&m); ll cnt=0; if(m>n)swa…
bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #define ll long long ll lowbit(ll x) { return x&(-x); } int main() { ll t; cin>>t; ll x; while(t--) { cin>>x; ll res=1; while((x&1)==0) {…
bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #define ll long long int main() { int T; cin >> T; while (T--) { ll n, x; cin >> x >> n; if (n == 1) { cout << x << endl; contin…
bryce1010模板 http://codeforces.com/gym/101810/problem/A 大模拟,写崩了,代码借队友的...... 注意处理段与段的连接问题: #include<bits/stdc++.h> using namespace std; const int maxn=1e5+5; struct node{ long long l,r,val; node(){} node(long long ll,long long rr,long long vval) { l=…
https://codeforces.com/gym/101810 A. Careful Thief time limit per test 2.5 s memory limit per test 256 MB input standard input output standard output There are consecutive buildings numbered from 1 to 109 each of which has an amount of money in it. T…
11.9 线段树 http://acm.hdu.edu.cn/showproblem.php?pid=6315 求逆序对个数 http://acm.hdu.edu.cn/showproblem.php?pid=6318 必赢博弈 http://acm.hdu.edu.cn/showproblem.php?pid=6312 欧拉回路 http://acm.hdu.edu.cn/showproblem.php?pid=6311 好难的构造题目 http://acm.hdu.edu.cn/showpr…
 Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Andréh and his friend Andréas are board-game aficionados. They know many of their friend…
 Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Thai cuisine is known for combining seasonings so that every dish has flavors that are…
Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Practice  Description standard input/output Ayutthaya was one of the first kingdoms in Thailand, spanning since its foundation in 1350 to…
 Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output At the ruins of Wat Phra Si Sanphet (วดพระศรสรรเพชญ), one can find famous inscr…
题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an array A of integers of size N, and Q queries. For each query, you will be given a set of distinct integers S and two integers L and R that represent a…
题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury of Berland regional olympiad in informatics does not trust to contest management systems, so the Berland regional programming contest is judged by th…
题目链接 http://codeforces.com/gym/100917/problem/D problem description Famous Berland coder and IT manager Linus Gates announced his next proprietary open-source system "Winux 10.04 LTS" In this system command "dir -C" prints list of all…
题目链接 http://codeforces.com/gym/101102/problem/D problem  description Given an R×C grid with each cell containing an integer, find the number of subrectangles in this grid that contain only one distinct integer; this means every cell in a subrectangle…
题目链接 http://codeforces.com/gym/101102/problem/C problem description Judge Bahosain was bored at ACM AmrahCPC 2016 as the winner of the contest had the first rank from the second hour until the end of the contest. Bahosain is studying the results of t…
Gym Class  Accepts: 849  Submissions: 4247  Time Limit: 6000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) Problem Description 众所周知,度度熊喜欢各类体育活动. 今天,它终于当上了梦寐以求的体育课老师.第一次课上,它发现一个有趣的事情.在上课之前,所有同学要排成一列, 假设最开始每个人有一个唯一的ID,从1到NN,在排好队之后,每个…
Weird Cryptography Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Gym 100935B Description standard input/output Khaled was sitting in the garden under an apple tree, suddenly! , well... you should guess what happened, a…
Board Game Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Gym 100935G Description standard input/outputStatements Feras bought to his nephew Saleem a new game to help him learning calculating. The game consists of a boa…
Gym 100935F A Poet Computer Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Description standard input/output The ACM team is working on an AI project called (Eih Eye Three) that allows computers to write poems. One of th…
Evil Time Limit: 5 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100463/attachments Description Richard is evil. He wants to give another geometry problem to the participants of this contest and I’m afraid I have no choice but to comply. Wh…
Crossings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100463 Description Given a permutation P of {0, 1, ..., n − 1}, we define the crossing number of it as follows. Write the sequence 0, 1, 2, . . . , n − 1 from left to ri…
J. Deck Shuffling Time Limit: 2   Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/J Description The world famous scientist Innokentiy continues his innovative experiments with decks of cards. Now he has a deck of n cards and k…
K. Perpetuum Mobile Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/K Description The world famous scientist Innokentiy almost finished the creation of perpetuum mobile. Its main part is the energy generator which…
Problem J. Triatrip Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description The travel agency “Four Russians” is offering the new service for their clients. Unlike other agencies that only suggest one-way…
Problem C. Painting CottagesTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description The new cottage settlement is organized near the capital of Flatland. The construction company that is building the settl…