time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab ch…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mahmoud has n line segments, the i-th of them has length ai. Ehab challenged him to use exactly 3 line segments to form a non-degenerate triangl…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical…
题目链接 Mahmoud and a xor trip 树形DP.先考虑每个点到他本身的距离和,再算所有点两两距离和. 做的时候考虑二进制拆位即可. #include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i(0); i < (n); ++i) #define rep(i, a, b) for(int i(a); i <= (b); ++i) #define LL long long const…
E. Mahmoud and a xor trip 题目连接: http://codeforces.com/contest/766/problem/E Description Mahmoud and Ehab live in a country with n cities numbered from 1 to n and connected by n - 1 undirected roads. It's guaranteed that you can reach any city from an…
地址:http://codeforces.com/contest/766/problem/E 题目: E. Mahmoud and a xor trip time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mahmoud and Ehab live in a country with n cities numbered from …