E. Ehab's REAL Number Theory Problem 数论+图论 求最小环 题目大意: 给你一个n大小的数列,数列里的每一个元素满足以下要求: 数据范围是:\(1<=a_i<=10^6\) \(a_i\) 最多只有7个因数 题目要求在这个数列找到一个最短的子数列,子数列的所有的数相乘是一个完全平方数. 题解: 这个题对于 \(x^{3}\) 应该等价于 \(x\) ,其实就是可以除去 \(a_i\)中的所有的平方项,显而易见,这个并不影响答案. 因为 \(a_i\) 最多只…
Ehab's REAL Number Theory Problem 前置知识 质数 分解质因数 无向无权图最小环<讲> Ehab's REAL Number Theory Problem/onCF 给 \(n\) 个数 \(a_i\)(\(a_i\) 的因数个数不超过 \(7\)),求最少选出多少个数,使得乘积为完全平方.无解输出 \(-1\). 数据范围:\(1\le n\le 10^5\),\(1\le a_i\le 10^6\). 没想到一场普通的 \(\texttt{CF}\) 比赛能…
http://codeforces.com/contest/325/problem/B B. Stadium and Games time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Daniel is organizing a football tournament. He has come up with the followin…
#include <iostream> #include <cstdio> #include <queue> #include <algorithm> #include <cmath> #include <cstring> #define inf 2147483647 #define N 10100 #define p(a) putchar(a) #define For(i,a,b) for(register long long i=…
D. Vika and Segments time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordina…
D. The Union of k-Segments time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output You are given n segments on the coordinate axis Ox and the number k. The point is satisfied if it belongs to at l…
B. Tavas and Malekas time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n co…
C. Tavas and Karafs time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in al…
A. Binary Blocks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an image, that can be represented with a 2-d n by m grid of pixels. Each pixel of the image is either on or o…
E. Strictly Positive Matrix time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have matrix a of size n × n. Let's number the rows of the matrix from 1 to n from top to bottom, let's number…