Contest Duration: - (local time) (110 minutes) Back to Home

Submission #846586

Source Code Expand

Copy
```#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#define SIZE 100005
#define INF 100000000000000LL

using namespace std;
typedef long long int ll;

map <ll,int> mp;
map <ll,int>::iterator it;

ll to(ll x)
{
for(ll i=2;;i++)
{
ll t=i*i*i;
if(t>x) break;
while(x%t==0) x/=t;
}
return x;
}
ll tg(ll x)//toしてる -> x=P*Q^2 に直したい -> そして、P^2*Qに
{
ll A=1,B=1;
for(ll i=2;;i++)
{
if(i*i*i>x) break;
int cnt=0;
while(x%i==0)
{
x/=i;
cnt++;
}
if(cnt==1) A*=i;
else if(cnt==2) B*=i;
}
//x/(A*B^2)=C*D^2だから、C=1 or D=1
ll dt=(ll) floor(sqrt(x)+0.5);
if(dt*dt==x) B*=dt;
else A*=x;
ll ret=A*B;
if(ret>INF/A+1) ret=INF;
else ret*=A;
return ret;
}
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
ll x;
scanf("%lld",&x);
x=to(x);
//printf("%lld ",x);
mp[x]++;
}
//puts("");
int ret=0;
for(it=mp.begin();it!=mp.end();it++)
{
ll x=it->first;
int cnt=it->second;
ll t=tg(x);
//if(x<=t) printf("%lld %lld : %d %d\n",x,t,mp[x],mp[t]);
if(x<t) ret+=max(cnt,mp[t]);
else if(x==t) ret++;
}
printf("%d\n",ret);
return 0;
}
```

#### Submission Info

Submission Time 2016-08-21 21:40:45+0900 D - Anticube yutaka1999 C++14 (GCC 5.4.1) 0 1250 Byte WA 3878 ms 10496 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:53:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
./Main.cpp:57: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
 AC × 3
 AC × 25 WA × 26
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 WA 3864 ms 6656 KB
02.txt WA 3863 ms 6656 KB
03.txt WA 3857 ms 6656 KB
04.txt WA 3855 ms 6656 KB
05.txt WA 3844 ms 6656 KB
06.txt WA 3864 ms 6656 KB
07.txt WA 3846 ms 6656 KB
08.txt WA 3870 ms 6656 KB
09.txt WA 3834 ms 6656 KB
10.txt WA 3826 ms 6656 KB
11.txt AC 3857 ms 2176 KB
12.txt AC 3858 ms 2176 KB
13.txt WA 2196 ms 4096 KB
14.txt WA 2196 ms 4096 KB
15.txt WA 2220 ms 4096 KB
16.txt WA 2202 ms 3968 KB
17.txt AC 62 ms 256 KB
18.txt AC 62 ms 256 KB
19.txt AC 62 ms 256 KB
20.txt AC 62 ms 256 KB
21.txt WA 3320 ms 4992 KB
22.txt WA 3314 ms 4992 KB
23.txt WA 3312 ms 4992 KB
24.txt WA 3306 ms 4992 KB
25.txt WA 3318 ms 4992 KB
26.txt WA 3304 ms 4992 KB
27.txt AC 693 ms 10496 KB
28.txt AC 17 ms 256 KB
29.txt AC 22 ms 256 KB
30.txt WA 18 ms 256 KB
31.txt AC 19 ms 256 KB
32.txt AC 18 ms 256 KB
33.txt AC 4 ms 256 KB
34.txt AC 54 ms 256 KB
35.txt AC 53 ms 256 KB
36.txt AC 3 ms 256 KB
37.txt WA 3864 ms 2816 KB
38.txt WA 3867 ms 2816 KB
39.txt WA 3872 ms 2944 KB
40.txt WA 3878 ms 2944 KB
41.txt AC 4 ms 256 KB
42.txt AC 3 ms 256 KB
43.txt AC 4 ms 256 KB
44.txt AC 4 ms 256 KB
45.txt AC 5 ms 256 KB
46.txt AC 4 ms 256 KB
47.txt WA 4 ms 256 KB
48.txt AC 3 ms 256 KB
s1.txt AC 3 ms 256 KB
s2.txt AC 3 ms 256 KB
s3.txt AC 4 ms 256 KB