Submission #1517433
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair int x; vector<int> pr; int isprime(int x){ int i; int cou=0; for(i=2;i<x;i++){ if(x%i==0) {cou++; break; } } if(cou==0) return 1; else return 0; } int main(){ x=2200; int n; int i,j; cin>>n; ll a[n+1]; int fl=0; map<pair<ll,ll>, int> w; for(i=2;i<x;i++){ if(isprime(i)){ pr.pb(i); } } for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=n;i++){ ll x=a[i],y=1,z=1; for(j=0;j<pr.size();j++){ int cou=0; while(x%pr[j]==0){ cou++; x=x/pr[j]; } cou=cou%3; if(cou==1){ y=y*pr[j]; z=z*pr[j]*pr[j]; } if(cou==2){ z=z*pr[j]; y=y*pr[j]*pr[j]; } } if(x){ ll xx=(ll)sqrt(x); if(xx*xx==x) { y=y*x; z=z*xx; } else { y=y*x; z=z*(x)*x; } } pair<ll,ll> t=mp(y,z); if(y==1&&z==1){ fl=1; } else w[t]=w[t]+1; } map<pair<ll,ll>, int>::iterator z=w.begin(); int ans=0; while(z!=w.end()){ pair<ll,ll> x=(*z).first; pair<ll,ll> o; o.first=x.second; o.second=x.first; int u=w[o]; ans=ans+max(u,w[x]); z++; } ans=ans/2; ans=ans+fl; cout<<ans<<endl; return 0;}
Submission Info
Submission Time | |
---|---|
Task | D - Anticube |
User | adam1007 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1658 Byte |
Status | WA |
Exec Time | 494 ms |
Memory | 13568 KB |
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 | WA | 482 ms | 13568 KB |
02.txt | WA | 488 ms | 13568 KB |
03.txt | WA | 483 ms | 13568 KB |
04.txt | WA | 482 ms | 13568 KB |
05.txt | WA | 482 ms | 13568 KB |
06.txt | WA | 482 ms | 13568 KB |
07.txt | WA | 482 ms | 13568 KB |
08.txt | WA | 482 ms | 13568 KB |
09.txt | WA | 488 ms | 13568 KB |
10.txt | WA | 482 ms | 13568 KB |
11.txt | WA | 423 ms | 4992 KB |
12.txt | WA | 424 ms | 4864 KB |
13.txt | WA | 414 ms | 4992 KB |
14.txt | WA | 414 ms | 4864 KB |
15.txt | WA | 414 ms | 4992 KB |
16.txt | WA | 413 ms | 4864 KB |
17.txt | AC | 423 ms | 1024 KB |
18.txt | AC | 423 ms | 1024 KB |
19.txt | AC | 423 ms | 1024 KB |
20.txt | AC | 423 ms | 1024 KB |
21.txt | WA | 449 ms | 8576 KB |
22.txt | WA | 449 ms | 8576 KB |
23.txt | WA | 449 ms | 8576 KB |
24.txt | WA | 449 ms | 8576 KB |
25.txt | WA | 449 ms | 8576 KB |
26.txt | WA | 449 ms | 8448 KB |
27.txt | AC | 494 ms | 11264 KB |
28.txt | AC | 359 ms | 1024 KB |
29.txt | AC | 364 ms | 1024 KB |
30.txt | WA | 374 ms | 1024 KB |
31.txt | AC | 368 ms | 1024 KB |
32.txt | AC | 368 ms | 1024 KB |
33.txt | AC | 2 ms | 256 KB |
34.txt | AC | 427 ms | 1024 KB |
35.txt | AC | 420 ms | 1024 KB |
36.txt | AC | 2 ms | 256 KB |
37.txt | WA | 426 ms | 5888 KB |
38.txt | WA | 426 ms | 5888 KB |
39.txt | WA | 425 ms | 5888 KB |
40.txt | WA | 426 ms | 5888 KB |
41.txt | AC | 2 ms | 256 KB |
42.txt | AC | 2 ms | 256 KB |
43.txt | AC | 2 ms | 256 KB |
44.txt | AC | 2 ms | 256 KB |
45.txt | AC | 2 ms | 256 KB |
46.txt | AC | 2 ms | 256 KB |
47.txt | WA | 2 ms | 256 KB |
48.txt | AC | 2 ms | 256 KB |
s1.txt | AC | 2 ms | 256 KB |
s2.txt | AC | 2 ms | 256 KB |
s3.txt | AC | 2 ms | 256 KB |