| 19 | vector<int> d[N]; |
| 20 | int cnt[N], ans[N]; |
| 21 | int32_t main() { |
| 22 | for(int i = 1; i < N; i++) for(int j = i; j < N; j += i) d[j].eb(i); |
| 23 | int n = 72; |
| 24 | vector<int> di = d[n]; |
| 25 | int s = di.size(); |
| 26 | map<int, int> id; |
| 27 | for(int i = 0; i < s; i++) id[di[i]] = i; |
| 28 | for(int i = 0; i < s; i++) ans[i] = rand(), cnt[i] = ans[i]; |
| 29 | for(int i = 0; i < s; i++) cout << ans[i] << ' '; |
| 30 | cout << nl; |
| 31 | vector<int> P = {2, 3}; |
| 32 | for(auto k : P) { |
| 33 | for(int i = 0; i < s; i++) { |
| 34 | if(di[i] % k == 0) { |
| 35 | ans[id[di[i] / k]] -= ans[i]; |
| 36 | //assert(id[di[i]/x.F]<i); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | for(int i = s - 1; i >= 0; i--) { |
| 41 | for(int j = i + 1; j < s; j++) if(di[j] % di[i] == 0) cnt[i] -= cnt[j]; |
| 42 | } |
| 43 | for(int i = 0; i < s; i++) cout << ans[i] << ' '; |
| 44 | cout << nl; |
| 45 | for(int i = 0; i < s; i++) cout << cnt[i] << ' '; |
| 46 | cout << nl; |
| 47 | return 0; |
| 48 | } |