Submission #848321
Source Code Expand
Copy
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e5+10;
bool p[SIZE];
VI pp;
int main(){
REPP(i,2,SIZE){
if(!p[i])pp.PB(i);
for(int j=i+i;j<SIZE;j+=i)p[j]=1;
}
DRI(N);
map<LL,int>H;
int one=1,an=0;
REP(tt,N){
LL x,me=1,you=1;
cin>>x;
for(int i=0;pp[i]*(LL)pp[i]<=x;++i){
if(x%pp[i]==0){
int cc=0;
while(x%pp[i]==0){
x%=pp[i];cc++;
}
cc%=3;
if(cc==1)me*=pp[i],you*=pp[i]*(LL)pp[i];
else if(cc==2)you*=pp[i],me*=pp[i]*(LL)pp[i];
}
}
if(x!=1)me*=x,you*=x*x;
if(me==1)one=1;
else{
if(H[you])H[you]--,an++;
else H[me]++;
}
}
for(map<LL,int>::iterator it=H.begin();it!=H.end();it++)an+=it->S;
cout<<an+one<<endl;
return 0;
}
Submission Info
Submission Time
2016-08-21 22:47:51+0900
Task
D - Anticube
User
dreamoon
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
1741 Byte
Status
WA
Exec Time
5257 ms
Memory
3456 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:37:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
DRI(N);
^
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
5253 ms
384 KB
02.txt
TLE
5253 ms
384 KB
03.txt
TLE
5253 ms
384 KB
04.txt
TLE
5257 ms
384 KB
05.txt
TLE
5257 ms
384 KB
06.txt
TLE
5253 ms
384 KB
07.txt
TLE
5253 ms
384 KB
08.txt
TLE
5253 ms
384 KB
09.txt
TLE
5253 ms
384 KB
10.txt
TLE
5253 ms
384 KB
11.txt
TLE
5253 ms
3456 KB
12.txt
TLE
5257 ms
3456 KB
13.txt
TLE
5253 ms
384 KB
14.txt
TLE
5253 ms
384 KB
15.txt
TLE
5253 ms
384 KB
16.txt
TLE
5253 ms
384 KB
17.txt
TLE
5253 ms
384 KB
18.txt
TLE
5253 ms
384 KB
19.txt
TLE
5253 ms
384 KB
20.txt
TLE
5253 ms
384 KB
21.txt
TLE
5253 ms
384 KB
22.txt
TLE
5257 ms
384 KB
23.txt
TLE
5253 ms
384 KB
24.txt
TLE
5256 ms
384 KB
25.txt
TLE
5257 ms
384 KB
26.txt
TLE
5253 ms
384 KB
27.txt
TLE
5253 ms
384 KB
28.txt
AC
34 ms
384 KB
29.txt
TLE
5253 ms
384 KB
30.txt
TLE
5257 ms
384 KB
31.txt
TLE
5257 ms
384 KB
32.txt
TLE
5253 ms
384 KB
33.txt
WA
7 ms
384 KB
34.txt
TLE
5253 ms
384 KB
35.txt
TLE
5253 ms
384 KB
36.txt
TLE
5253 ms
384 KB
37.txt
TLE
5253 ms
384 KB
38.txt
TLE
5253 ms
384 KB
39.txt
TLE
5257 ms
384 KB
40.txt
TLE
5257 ms
384 KB
41.txt
TLE
5253 ms
384 KB
42.txt
TLE
5257 ms
384 KB
43.txt
TLE
5257 ms
384 KB
44.txt
TLE
5257 ms
384 KB
45.txt
TLE
5253 ms
384 KB
46.txt
AC
7 ms
384 KB
47.txt
TLE
5253 ms
384 KB
48.txt
AC
7 ms
384 KB
s1.txt
TLE
5253 ms
384 KB
s2.txt
TLE
5253 ms
384 KB
s3.txt
TLE
5253 ms
384 KB