QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#314052#836. Farm of MonstersCharlieVinnieRE 1ms3808kbC++171002b2024-01-25 11:43:202024-01-25 11:43:22

Judging History

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

  • [2024-01-25 11:43:22]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3808kb
  • [2024-01-25 11:43:20]
  • 提交

answer

#include "bits/stdc++.h"
#ifdef DEBUG
#include "PrettyDebug.hpp"
#else
#define debug(...) [](auto...){}(__VA_ARGS__)
#define debuga(...) [](auto...){}(__VA_ARGS__)
#endif
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
using namespace std; typedef long long ll;
constexpr int N=3e5+5;
int n,A,B; priority_queue<int> q;
signed main(){
    atexit([](){cerr<<"Time = "<<clock()<<" ms"<<endl;});
    cin>>n>>A>>B; int ans=0,cur=0;
    For(i,1,n){
        int x; cin>>x;
        int b=(x+B-1)/B;
        int a=((x-1)%B+1+A-1)/A;
        cur+=b-a-1; q.push(a+1); ans++;
        while(cur<-1) ans--,cur+=q.top(),q.pop();
    }
    cout<<ans<<'\n';
    return 0;
}

// START TYPING IF YOU DON'T KNOW WHAT TO DO
// STOP TYPING IF YOU DON'T KNOW WHAT YOU'RE DOING
// CONTINUE, NON-STOPPING, FOR CHARLIEVINNIE

// Started Coding On: January 25 Thu, 11 : 38 : 54

详细

Test #1:

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

input:

3 1 1
1 1 1

output:

2

result:

ok answer is '2'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

3 1 1
2 2 2

output:

3

result:

ok answer is '3'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

10 34 100
17 27 73 17 60 12 25 53 31 46

output:

5

result:

ok answer is '5'

Test #4:

score: -100
Runtime Error

input:

300000 1 1
336470888 634074578 642802746 740396295 773386884 579721198 396628655 503722503 971207868 202647942 2087506 268792718 46761498 443917727 16843338 125908043 691952768 717268783 787375312 150414369 693319712 519096230 45277106 856168102 762263554 674936674 407246545 274667941 279198849 5272...

output:


result: