0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 23:08:47 +00:00

D - Anticube

https://atcoder.jp/contests/agc003/submissions/38309968
This commit is contained in:
Baoshuo Ren 2023-01-25 08:14:35 +08:00
parent 478f76eefc
commit 4ebd0ccbb2
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
104 changed files with 579 additions and 0 deletions

85
AtCoder/AGC003/D/D.cpp Normal file
View File

@ -0,0 +1,85 @@
#include <iostream>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e5 + 5,
M = 3005;
int n, ans;
std::vector<long long> primes;
bool not_prime[N];
std::unordered_map<long long, int> map;
std::vector<std::pair<long long, long long>> data;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
for (int i = 2; i < M; i++) {
if (!not_prime[i]) primes.emplace_back(i);
for (auto p : primes) {
if (i * p >= M) break;
not_prime[i * p] = true;
if (i % p == 0) break;
}
}
cin >> n;
for (int i = 1; i <= n; i++) {
long long x, y = 1, z = 1;
cin >> x;
for (auto p : primes) {
if (p * p > x) break;
int t = 0;
while (x % p == 0) {
x /= p;
t++;
}
t %= 3;
if (t == 0) continue;
for (int k = 1; k <= t; k++) y *= p;
for (int k = 1; k <= 3 - t; k++) z *= p;
}
y *= x;
if (x > 1) {
long long t = std::sqrt(x);
if (t * t == x) z *= std::sqrt(x);
else z *= x * x;
}
map[y]++;
data.emplace_back(y, z);
}
ans = map[1] > 0;
for (auto o : data) {
if (o.first == 1) continue;
ans += std::max(map[o.first], map[o.second]);
map[o.first] = map[o.second] = 0;
}
cout << ans << endl;
return 0;
}

BIN
AtCoder/AGC003/D/data/01.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/01.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/02.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/02.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/03.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/03.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/04.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/04.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/05.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/05.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/06.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/06.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/07.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/07.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/08.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/08.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/09.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/09.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/11.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/12.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/13.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/14.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/15.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/16.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/17.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/18.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/19.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/20.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/21.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/21.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/22.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/22.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/23.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/23.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/24.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/24.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/25.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/25.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/26.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/26.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/27.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/27.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/28.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/28.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/29.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/29.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/30.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/30.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/31.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/31.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/32.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/32.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/33.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/33.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/34.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/34.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/35.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/35.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/36.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/36.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/37.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/37.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/38.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/38.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/39.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/39.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/40.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/40.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/41.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/41.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/42.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/42.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/43.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/43.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/44.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/44.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/45.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/45.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/46.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/46.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/47.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/47.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/48.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/48.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/s1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/s1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
AtCoder/AGC003/D/data/s2.in (Stored with Git LFS) Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More