Submission #848130
Source Code Expand
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+10;
int fact[N];
unordered_map<ll,int> mp;
vector<int> pr;
int main() {
for (int i=2;i*i<N;i++) if (!fact[i])
for (int j=i;i*j<N;j++) fact[i*j] = i;
for (int i=2;i<N;i++) if (!fact[i]) pr.push_back(i);
int n;
scanf("%d",&n);
int ans = 0;
for (int i=0;i<n;i++) {
ll x;
scanf("%lld",&x);
for (int j : pr) {
if (1ll*j*j*j > x) break;
while (x % (1ll*j*j*j) == 0) x /= 1ll*j*j*j;
}
ll t = x;
ll y = 1;
ll z = 1;
for (int p : pr) {
if (t < p) break;
if (t % (1ll*p*p) == 0) {
y *= p;
z *= 1ll*p*p;
t /= 1ll*p*p;
}
else if (t % p == 0) {
y *= 1ll*p*p;
z *= p;
t /= p;
}
}
//cout << x << " " << y << " " << z << endl;
if (x != z) ans++;
else {
mp[x]++;
if (mp[x] > mp[y]) ans++;
}
}
if (mp[1]) ans++;
printf("%d\n",ans);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Anticube |
| User | tcchung |
| Language | C++14 (GCC 5.4.1) |
| Score | 0 |
| Code Size | 949 Byte |
| Status | TLE |
| Exec Time | 5265 ms |
| Memory | 7880 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:13:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:17:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&x);
^
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 1100 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | TLE | 5257 ms | 1280 KiB |
| 02.txt | TLE | 5257 ms | 1152 KiB |
| 03.txt | TLE | 5253 ms | 1152 KiB |
| 04.txt | TLE | 5257 ms | 1280 KiB |
| 05.txt | TLE | 5257 ms | 1152 KiB |
| 06.txt | TLE | 5257 ms | 1280 KiB |
| 07.txt | TLE | 5257 ms | 1280 KiB |
| 08.txt | TLE | 5257 ms | 1152 KiB |
| 09.txt | TLE | 5253 ms | 1152 KiB |
| 10.txt | TLE | 5257 ms | 1152 KiB |
| 11.txt | TLE | 5253 ms | 768 KiB |
| 12.txt | TLE | 5257 ms | 768 KiB |
| 13.txt | TLE | 5256 ms | 1024 KiB |
| 14.txt | TLE | 5257 ms | 1024 KiB |
| 15.txt | TLE | 5253 ms | 1024 KiB |
| 16.txt | TLE | 5265 ms | 1024 KiB |
| 17.txt | AC | 80 ms | 768 KiB |
| 18.txt | AC | 80 ms | 768 KiB |
| 19.txt | AC | 80 ms | 768 KiB |
| 20.txt | AC | 80 ms | 768 KiB |
| 21.txt | TLE | 5257 ms | 1024 KiB |
| 22.txt | TLE | 5257 ms | 896 KiB |
| 23.txt | TLE | 5257 ms | 896 KiB |
| 24.txt | TLE | 5253 ms | 896 KiB |
| 25.txt | TLE | 5257 ms | 896 KiB |
| 26.txt | TLE | 5253 ms | 896 KiB |
| 27.txt | AC | 3038 ms | 7880 KiB |
| 28.txt | AC | 25 ms | 768 KiB |
| 29.txt | AC | 30 ms | 768 KiB |
| 30.txt | AC | 33 ms | 768 KiB |
| 31.txt | AC | 33 ms | 768 KiB |
| 32.txt | AC | 33 ms | 768 KiB |
| 33.txt | AC | 6 ms | 768 KiB |
| 34.txt | AC | 75 ms | 768 KiB |
| 35.txt | AC | 60 ms | 768 KiB |
| 36.txt | AC | 6 ms | 768 KiB |
| 37.txt | TLE | 5253 ms | 768 KiB |
| 38.txt | TLE | 5257 ms | 768 KiB |
| 39.txt | TLE | 5253 ms | 768 KiB |
| 40.txt | TLE | 5257 ms | 768 KiB |
| 41.txt | AC | 6 ms | 768 KiB |
| 42.txt | AC | 6 ms | 768 KiB |
| 43.txt | AC | 7 ms | 768 KiB |
| 44.txt | AC | 6 ms | 768 KiB |
| 45.txt | AC | 6 ms | 768 KiB |
| 46.txt | AC | 6 ms | 768 KiB |
| 47.txt | AC | 6 ms | 768 KiB |
| 48.txt | AC | 6 ms | 768 KiB |
| s1.txt | AC | 6 ms | 768 KiB |
| s2.txt | AC | 5 ms | 768 KiB |
| s3.txt | AC | 7 ms | 768 KiB |