QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#735225#9129. Quotient Sumucup-team134#WA 0ms4012kbC++141.3kb2024-11-11 18:28:352024-11-11 18:28:36

Judging History

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

  • [2024-11-11 18:28:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4012kb
  • [2024-11-11 18:28:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=200050;
const ll inf=9e18;
ll a[N];
mt19937 rng(time(0));
int main(){
    int n;
    scanf("%i",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
    }
    sort(a+1,a+1+n);
    ll ans=a[n]/a[1];
    ll now=0;
    for(int i=2;i<=n-1;i++){
        now+=a[i]/a[i-1];
        ans=min(ans,now+a[n]/a[i]);
    }
    printf("%lld\n",ans);

    /*int t;
    scanf("%i",&t);
    while(t--){
        int n=rng()%10+1;
        for(int i=1;i<=n;i++){
            //scanf("%lld",&a[i]);
            a[i]=rng()%10000+1;
        }
        sort(a+1,a+1+n);
        ll ans=inf;
        vector<vector<ll>> best;
        do{
            ll now=0;
            for(int i=2;i<=n;i++){
                now+=a[i]/a[i-1];
            }
            now+=a[1]/a[n];
            if(ans>now)best.clear();
            ans=min(ans,now);
            if(ans==now){
                vector<ll> arr;
                for(int i=1;i<=n;i++)arr.pb(a[i]);
                best.pb(arr);
            }
        }while(next_permutation(a+2,a+1+n));
        printf("%lld\n",ans);
        for(auto v:best){
            for(ll x:v)printf("%lld ",x);
            printf("\n");
        }
    }*/
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
2 3 6

output:

3

result:

ok "3"

Test #2:

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

input:

2
15 4

output:

3

result:

ok "3"

Test #3:

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

input:

9
284791808 107902 13660981249408 4622332661 13405199 24590921 361 244448137 16077087227955422

output:

4580

result:

ok "4580"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 4012kb

input:

9
12 9 5 17 2 6 7 1 15

output:

7

result:

wrong answer 1st words differ - expected: '6', found: '7'