# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
168855 |
2019-12-16T17:01:15 Z |
kostia244 |
Toys (CEOI18_toy) |
C++17 |
|
11 ms |
10492 KB |
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,sse2,sse,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC comment("/STACK:26666666")
#include<bits/stdc++.h>
#include<bits/extc++.h>
using namespace __gnu_pbds;
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
using vi = vector<ll>;
const int mod = 1e9 + 7;
ll n;
vi divs, cans[100100], canb[100100];
int id[100100];
unordered_map<int, int> vis[100100];
__attribute__((always_inline)) inline bool mark(ll i, ll cur) {
ll x = (i*i <= n ? id[i] : id[31628+(n/i)]);
if(vis[x][cur]) return false;
vis[x][cur] = 1;
return true;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
ll tn = n;
int x = 0;
for (ll d = 1; d * d <= tn; d++) {
if (tn % d)
continue;
divs.pb(d);
id[d] = x++;
if (d * d != n) {
id[31628+d]=x++;
divs.pb(n / d);
}
}
sort(all(divs));
cans[1].pb(0);
for (auto i : divs) {
vi &t = (i * i <= n ? cans[i] : canb[n / i]);
sort(all(t));
t.erase(unique(all(t)), t.end());
for (auto j : divs) {
if(j==1)continue;
if (i * j > n)
break;
if (n % (i * j))
continue;
ll _nxt = i * j;
vi &nxt = (_nxt * _nxt <= n ? cans[_nxt] : canb[n / _nxt]);
for (auto q : t) {
if(mark(_nxt, q+j-1))
nxt.pb(q + j - 1);
}
}
}
vi &t = (n * n <= n ? cans[n] : canb[n / n]);
sort(all(t));
cout << t.size() << "\n";
// for (auto i : t)
// cout << i << " ";
}
Compilation message
toy.cpp:4:0: warning: ignoring #pragma GCC comment [-Wunknown-pragmas]
#pragma GCC comment("/STACK:26666666")
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
10492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
10492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
10492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
10492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
10492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |