Submission #2375715
Source Code Expand
#include <bits/stdc++.h> #define int long long using namespace std; typedef long long ll; vector<ll> primeFactor(ll x){ //if(x < 2) return {x}; /*!!!!!!!!!!!!!!!!!!!*/ assert(x > 1);/*!!!!!!!!!!!!!!!!!!!*/ vector<ll> res; for(ll i=2;i*i <= x;i++) while(x%i == 0){ x/=i; res.push_back(i); } if(x != 1) res.push_back(x); return res; } int ans[100005], A[100005]; signed main(){ int n, m; cin>>n>>m; map<int,int> cnt; for(int i=0;i<n;i++){ cin>>A[i]; if( A[i] == 1 ) continue; set<ll> a; vector<ll> b = primeFactor(A[i]); for(auto x : b ) a.insert(x); vector<ll> c; for(auto x : a ) c.push_back(x); int len = c.size(); for(int j=1;j<(1<<len);j++){ int mul = 1; for(int k=0;k<len;k++){ if( j >> k & 1 ) mul *= c[k]; } if( __builtin_popcount(j) == 1 ) cnt[mul]++; else cnt[mul]--; } } cout<<n<<endl; for(int i=2;i<=m;i++){ set<ll> a; vector<ll> b = primeFactor(i); for(auto x : b ) a.insert(x); vector<ll> c; for(auto x : a ) c.push_back(x); int len = c.size(); int ans = n; for(int j=1;j<(1<<len);j++){ int mul = 1; for(int k=0;k<len;k++){ if( j >> k & 1 ) mul *= c[k]; } ans -= cnt[mul]; } cout<<ans<<endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Squared Graph |
User | Gacho_0716 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1579 Byte |
Status | RE |
Exec Time | 1015 ms |
Memory | 9856 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 800 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt |
All | sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in2.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | WA | 1 ms | 256 KB |
in10.txt | RE | 96 ms | 256 KB |
in11.txt | WA | 1 ms | 256 KB |
in12.txt | RE | 325 ms | 4864 KB |
in13.txt | WA | 389 ms | 5120 KB |
in14.txt | WA | 579 ms | 5376 KB |
in15.txt | RE | 130 ms | 1408 KB |
in16.txt | WA | 473 ms | 4608 KB |
in17.txt | WA | 400 ms | 4608 KB |
in18.txt | WA | 724 ms | 7040 KB |
in19.txt | WA | 581 ms | 5376 KB |
in2.txt | WA | 1 ms | 256 KB |
in20.txt | WA | 576 ms | 5504 KB |
in21.txt | WA | 998 ms | 9856 KB |
in22.txt | WA | 790 ms | 8960 KB |
in23.txt | WA | 790 ms | 8704 KB |
in24.txt | RE | 101 ms | 384 KB |
in25.txt | WA | 1015 ms | 9856 KB |
in26.txt | WA | 1 ms | 256 KB |
in27.txt | WA | 4 ms | 256 KB |
in28.txt | WA | 1011 ms | 9856 KB |
in3.txt | WA | 2 ms | 256 KB |
in4.txt | WA | 2 ms | 256 KB |
in5.txt | WA | 844 ms | 8320 KB |
in6.txt | RE | 121 ms | 1280 KB |
in7.txt | RE | 124 ms | 512 KB |
in8.txt | RE | 169 ms | 2432 KB |
in9.txt | WA | 416 ms | 4096 KB |
sample1.txt | RE | 97 ms | 256 KB |
sample2.txt | WA | 1 ms | 256 KB |