牛客算法周周练11 A.切题之路 签到题

链接:https://ac.nowcoder.com/acm/contest/6046/A
来源:牛客网

题目描述

众所周知,SD省有一个可爱的妹子,叫做rqy(rqy天下第一可爱!不接受反驳,抱走rqy~),她经常(雾)和一个叫做clccle的蒟蒻一起刷题,但是因为clccle太弱了,所以说她会跳过难度较高的题目,同时,如果clccle的时间不足以切掉当前这道简单题,那么她同时也会跳过这道简单题目,相对的,rqy要花掉两倍的时间去切掉一道难度较高的题目,但如果时间不够用,她会跳过这道题目,但是有一个特殊规定,因为她们两个人都非常懒,所以她们只会按给定的顺序刷,现在两人的刷题列表是一样的,请求出在给定时间里clccle和rqy各最多能刷多少道题目。

输入描述:

第一行,两个整数n,t,表示有n道题目,给定的时间为t

第二行 两个整数a,b 分别表示clccle所认为的难度较高和rqy认为的难度较高

接下来两行,每行n个数字 第一行表示切题所需的时间,第二行表示题目的难度

输出描述:

输出两个整数,分别表示clccle和rqy的切题数

示例1
输入
复制

2 100
6 10
100 10
7 5

输出
复制

1 1

说明

clccle会跳过第一道题去切第二道题,而rqy会把时间都花在第一题上,P.s.100 10指的是两道题目所需的时间 7 5指的是题目的难度

备注:

难度较高为大于等于给定难度(>=)

1<=n<=100000, 1<=a,b<=1e9






题意没有看懂,读了别人的代码才知道题目意思,我还是太菜了QAQ
题意 :
两个人AB一起按顺序做题,
A不写难度大于 H A H_A HA的题
B什么难度的题都写,且如果题目难度大于等于 H B H_B HB,就要花费双倍时间
求两个人分别写了多少题目

#define debug
#ifdef debug
#include <time.h>
#include "/home/majiao/mb.h"
#endif

#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>

#define MAXN ((int)1e5+7)
#define ll long long 
#define int long long 
#define INF (0x7f7f7f7f)
#define fori(lef, rig) for(int i=lef; i<=rig; i++)
#define forj(lef, rig) for(int j=lef; j<=rig; j++)
#define fork(lef, rig) for(int k=lef; k<=rig; k++)
#define QAQ (0)

using namespace std;

#define show(x...)                             \
    do {                                       \
        cout << "\033[31;1m " << #x << " -> "; \
        err(x);                                \
    } while (0)

void err() { cout << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }

namespace FastIO {

	char print_f[105];
	void read() { }
	void print() { putchar('\n'); }

	template <typename T, typename... T2>
		inline void read(T &x, T2 &... oth) {
			x = 0;
			char ch = getchar();
			ll f = 1;
			while (!isdigit(ch)) {
				if (ch == '-') f *= -1; 
				ch = getchar();
			}
			while (isdigit(ch)) {
				x = x * 10 + ch - 48;
				ch = getchar();
			}
			x *= f;
			read(oth...);
		}
	template <typename T, typename... T2>
		inline void print(T x, T2... oth) {
			ll p3=-1;
			if(x<0) putchar('-'), x=-x;
			do{
				print_f[++p3] = x%10 + 48;
			} while(x/=10);
			while(p3>=0) putchar(print_f[p3--]);
			putchar(' ');
			print(oth...);
		}
} // namespace FastIO
using FastIO::print;
using FastIO::read;

int n, m, Q, K, A, B;

struct Node {
	int time, dif;
} a[MAXN];

signed main() {
#ifdef debug
	freopen("test", "r", stdin);
	// freopen("out_main", "w", stdout);
	clock_t stime = clock();
#endif
	cin >> n >> m >> A >> B;
	for(int i=1; i<=n; i++) cin >> a[i].time;
	for(int i=1; i<=n; i++) cin >> a[i].dif;

	int T1 = m, T2 = m, cntA = 0, cntB = 0;
	for(int i=1; i<=n; i++) {
		if(a[i].dif<A && T1>=a[i].time) {
			cntA ++;
			T1 -= a[i].time;
		}
		if(a[i].dif<B && T2>=a[i].time) {
			cntB ++;
			T2 -= a[i].time;
		} else if(a[i].dif>=B && T2>=a[i].time*2) {
			cntB ++;
			T2 -= a[i].time*2;
		}
	}
	cout << cntA << " " << cntB << endl;



#ifdef debug
	clock_t etime = clock();
	printf("rum time: %lf 秒\n",(double) (etime-stime)/CLOCKS_PER_SEC);
#endif 
	return 0;
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值