Submission #848430


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
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 12928 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
AC × 3
AC × 24
WA × 21
TLE × 6
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 2211 ms 12928 KB
02.txt WA 2227 ms 12928 KB
03.txt WA 2219 ms 12928 KB
04.txt WA 2238 ms 12928 KB
05.txt WA 2196 ms 12928 KB
06.txt WA 2240 ms 12928 KB
07.txt WA 2305 ms 12928 KB
08.txt WA 2220 ms 12928 KB
09.txt WA 2217 ms 12928 KB
10.txt WA 2238 ms 12928 KB
11.txt TLE 5253 ms 3456 KB
12.txt TLE 5257 ms 3456 KB
13.txt WA 1491 ms 4224 KB
14.txt WA 1518 ms 4224 KB
15.txt WA 1517 ms 4224 KB
16.txt WA 1516 ms 4224 KB
17.txt AC 150 ms 384 KB
18.txt AC 150 ms 384 KB
19.txt AC 150 ms 384 KB
20.txt AC 150 ms 384 KB
21.txt AC 3927 ms 7936 KB
22.txt AC 3887 ms 7936 KB
23.txt AC 3900 ms 8064 KB
24.txt AC 3885 ms 7936 KB
25.txt AC 3912 ms 7936 KB
26.txt AC 3904 ms 7808 KB
27.txt AC 189 ms 10624 KB
28.txt AC 34 ms 384 KB
29.txt AC 46 ms 384 KB
30.txt WA 55 ms 384 KB
31.txt WA 53 ms 384 KB
32.txt WA 53 ms 384 KB
33.txt WA 7 ms 384 KB
34.txt WA 163 ms 384 KB
35.txt AC 155 ms 384 KB
36.txt AC 7 ms 384 KB
37.txt TLE 5253 ms 3968 KB
38.txt TLE 5254 ms 3968 KB
39.txt TLE 5254 ms 3968 KB
40.txt TLE 5253 ms 3968 KB
41.txt WA 7 ms 384 KB
42.txt WA 7 ms 384 KB
43.txt AC 7 ms 384 KB
44.txt AC 6 ms 384 KB
45.txt AC 7 ms 384 KB
46.txt AC 7 ms 384 KB
47.txt AC 7 ms 384 KB
48.txt AC 7 ms 384 KB
s1.txt AC 7 ms 384 KB
s2.txt AC 7 ms 384 KB
s3.txt AC 7 ms 384 KB