QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#745884 | #8250. Magnesium Supplementation | t-aswath | WA | 2ms | 3728kb | C++14 | 1.5kb | 2024-11-14 12:11:31 | 2024-11-14 12:11:31 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define deb(x...) 42
#endif
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
void solve() {
ll n,k,p;
cin>>n>>k>>p;
ll l=0,r=k;
while(r-l>1){
ll m=(l+r)/2;
if((m*p)>=n){
r=m;
}
else{
l=m+1;
}
}
set<ll> v;
for(ll i=1;i<=sqrt(n)+1;i++){
if(n%i==0)v.insert(i),v.insert(n/i);
}
vector<ll>ans;
for(auto i :v){
if(i>=l&&i<=min(n,k)){
ans.push_back(i);
}
}
cout<<ans.size()<<endl;
for(auto i:ans)cout<<i<<"\n";
}
int main() {
fast_io;
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("output.txt", "w", stderr);
#endif
ll t = 1;
// cin >> t;
for(ll i = 0; i < t; i++) {
#ifdef LOCAL
cout << "CASE " << i + 1 << ":\n";
#endif
solve();
}
#ifdef LOCAL
cout << endl << "Finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n\n";
#endif
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
6 6 4
output:
3 2 3 6
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
6 2 3
output:
1 2
result:
ok 2 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
735134400 425176838 584949686
output:
1342 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 22 24 25 26 27 28 30 32 33 34 35 36 39 40 42 44 45 48 50 51 52 54 55 56 60 63 64 65 66 68 70 72 75 77 78 80 84 85 88 90 91 96 99 100 102 104 105 108 110 112 117 119 120 126 130 132 135 136 140 143 144 150 153 154 156 160 165 168 170 175 176 180 1...
result:
ok 1343 lines
Test #4:
score: -100
Wrong Answer
time: 2ms
memory: 3728kb
input:
97772875200 83501089612 34623233641
output:
7 12221609400 13967553600 16295479200 19554575040 24443218800 32590958400 48886437600
result:
wrong answer 1st lines differ - expected: '4029', found: '7'