Submission #846413


Source Code Expand

Copy
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
#include <map>
using namespace std;
using ll = long long;

class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n;
public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}};

int main() {
  int N;
  while (scanf("%d", &N) != EOF) {
    map<vector<ll>, int> cnt;

    for (int i : range(N)) {
      ll x;
      scanf("%lld", &x);

      vector<ll> v;
      for (ll i = 2; i * i <= 100000; ++i) {
        if (x % i != 0) continue;
        ll r = 0;
        while (x % i == 0) {
          x /= i;
          r = (r + 1) % 3;
        }
        if (r) {
          v.push_back(i);
          v.push_back(r);
        }
      }
      if (x > 1) {
        v.push_back(x);
        v.push_back(1);
      }

      //for (auto y : v) cout << y << " " ;
      //cout << endl;
      cnt[v]++;
    }

    ll res = 0;
    for (auto& it : cnt) {
      vector<ll> now = it.first, cmp = now;
      if (now.size() == 0) {
        // special element
        res += 1;
        continue;
      }

      for (int i = 1; i < cmp.size(); i += 2) cmp[i] = 3 - cmp[i];
      if (now > cmp) continue;

      res += max(it.second, cnt[cmp]);
    }
    printf("%lld\n", res);
  }
}

Submission Info

Submission Time
Task D - Anticube
User ir5
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1515 Byte
Status WA
Exec Time 920 ms
Memory 25088 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:24: 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 887 ms 25088 KB
02.txt WA 885 ms 25088 KB
03.txt WA 892 ms 25088 KB
04.txt WA 881 ms 25088 KB
05.txt WA 884 ms 25088 KB
06.txt WA 920 ms 25088 KB
07.txt WA 890 ms 25088 KB
08.txt WA 886 ms 25088 KB
09.txt WA 879 ms 25088 KB
10.txt WA 881 ms 25088 KB
11.txt AC 700 ms 7040 KB
12.txt AC 700 ms 7040 KB
13.txt WA 708 ms 8320 KB
14.txt WA 713 ms 8320 KB
15.txt WA 708 ms 8320 KB
16.txt WA 707 ms 8320 KB
17.txt AC 789 ms 256 KB
18.txt AC 783 ms 256 KB
19.txt AC 788 ms 256 KB
20.txt AC 785 ms 256 KB
21.txt WA 807 ms 14336 KB
22.txt WA 808 ms 14336 KB
23.txt WA 814 ms 14336 KB
24.txt WA 800 ms 14336 KB
25.txt WA 809 ms 14336 KB
26.txt WA 816 ms 14336 KB
27.txt WA 839 ms 20096 KB
28.txt AC 628 ms 256 KB
29.txt AC 631 ms 256 KB
30.txt AC 687 ms 256 KB
31.txt AC 666 ms 256 KB
32.txt AC 672 ms 256 KB
33.txt AC 4 ms 256 KB
34.txt AC 736 ms 256 KB
35.txt AC 747 ms 256 KB
36.txt AC 4 ms 256 KB
37.txt WA 722 ms 8832 KB
38.txt WA 723 ms 8832 KB
39.txt WA 729 ms 8832 KB
40.txt WA 735 ms 8832 KB
41.txt AC 4 ms 256 KB
42.txt AC 4 ms 256 KB
43.txt AC 4 ms 256 KB
44.txt AC 4 ms 256 KB
45.txt AC 4 ms 256 KB
46.txt AC 4 ms 256 KB
47.txt WA 4 ms 256 KB
48.txt AC 4 ms 256 KB
s1.txt AC 4 ms 256 KB
s2.txt AC 4 ms 256 KB
s3.txt AC 4 ms 256 KB