QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#745831#8250. Magnesium Supplementationt-aswathTL 0ms3776kbC++141.3kb2024-11-14 11:51:152024-11-14 11:51:15

Judging History

你现在查看的是最新测评结果

  • [2024-11-14 11:51:15]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3776kb
  • [2024-11-14 11:51:15]
  • 提交

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;
        }
    }
    vector<ll> v;
    for(ll i=l;i<=min(n,k);i++){
        if(n%i==0)v.push_back(i);
    }
    cout<<v.size()<<endl;
    for(auto x:v)cout<<x<<"\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;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3776kb

input:

6 6 4

output:

3
2
3
6

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

6 2 3

output:

1
2

result:

ok 2 lines

Test #3:

score: -100
Time Limit Exceeded

input:

735134400 425176838 584949686

output:


result: