GYM101933I - Intergalactic Bidding


题解:不考虑首先显然是个背包,一开始直接用set模拟,然后map存方案,这样会mle。发现物品的体积有的特殊性

only one participant was allowed to make a bid at a time,
each participant was only allowed to make one bid, and
a participant making a bid had to bid at least twice the amount of the highest
bid at the time.

于是,直接对物品排序贪心取最大即可,因为对于种题目给定的s,一定有唯一的方法组成。

#include <bits/stdc++.h>
typedef long long ll;
const int N = 1e3 + 7;
using namespace std;
struct Big {char x[1005]; int len;string s;bool operator == (const Big &A) const {if(A.len != len) return 0;for(int i = 0; i < len; ++i) if(A.x[i] != x[i]) return 0;return 1;}bool operator < (const Big &A) const {if(A.len != len) return len < A.len;for(int i = len-1; i >= 0; --i) if(A.x[i] != x[i]) return x[i] < A.x[i];return 0;}Big operator + (const Big &A) const {Big ans = *this;for(int i = 0; i < A.len; ++i) {ans.x[i] = ans.x[i] + A.x[i];}int mx = max(A.len, len), f = 0;for(int i = 0; i < mx+1; ++i) {if(ans.x[i] >= 10) {ans.x[i]-=10; ++ans.x[i+1];}if(ans.x[i]) ans.len = i+1, f = 1;}if(!f) ans.len = 1;return ans;}Big operator - (const Big &A) const {Big ans = *this; int f = 0;for(int i = 0; i < A.len; ++i) {ans.x[i] = ans.x[i] - A.x[i];}int mx = max(A.len, len);for(int i = 0; i < mx+1; ++i) {if(ans.x[i] < 0) {ans.x[i]+=10; --ans.x[i+1];}if(ans.x[i]) ans.len = i+1, f = 1;}if(!f) ans.len = 1;return ans;}void read() {cin >> s; len = s.size();for(int i = 0; i < len; ++i) x[len-i-1] = s[i]-'0';s.clear();}void write() {for(int i = len-1; i >= 0; --i) printf("%d",x[i]); putchar('\n');}
} s, ZER;int n;
struct node{string nm; Big A;bool operator < (const node & a) const {return A < a.A;}
} a[N];
vector<int> ans;
int main() {ZER.x[0] = 0; ZER.len = 1;scanf("%d",&n);s.read();for(int i = 1; i <= n; ++i) {cin >> a[i].nm; a[i].A.read();}sort(a+1,a+1+n);for(int i = n ; i >= 1; --i) {if( a[i].A < s || s == a[i].A) {ans.push_back(i);s = s - a[i].A;}}if(s == ZER) {printf("%d\n",(int)ans.size());for(int i = 0; i < ans.size(); ++i) {cout << a[ans[i]].nm << '\n';}}else puts("0");return 0;
}

转载于:https://www.cnblogs.com/RRRR-wys/p/9817446.html

GYM101933I - Intergalactic Bidding相关推荐

  1. XCPC Team Trainning Round 1 (NCPC2018)

    补题地址 EOJ CF 榜单&补题情况 题解.分析和code一部分是自己写的,一部分是抄的队友的. A. Altruistic Amphibians 01背包 题意 给出n只青蛙和洞的高度d, ...

  2. 从海外客户端Bidding看,移动开发者应如何应对竞价模式变化?

    2021年,对于渴望通过广告进行变现的移动开发者来说,可能注定是风云变幻的一年,也将是移动互联网广告程序化购买这个行业程碑式的一年,对此很多国内出海开发者会有更早的感触. 自2020年三四季度始,大洋 ...

  3. How project description length and expected duration affect bidding and project success 论文笔记

    论文完整名称<How project description length and expected duration affect bidding and project success in ...

  4. ADSCOPE产品解读,Header Bidding的基本运营思路和应用技巧

    前不久,优量汇发布了开放Bidding自助能力的公告,支持自助接入.自助配置.自助测试,针对使用自建聚合/指定的第三方聚合平台的开发者,在满足相应条件的前提下,可以申请Bidding协议签署开启自助配 ...

  5. 论文复现《Deep Landscape Forecasting for Real-time Bidding Advertising》

    本文为笔记. 原论文:<Deep Landscape Forecasting for Real-time Bidding Advertising> Authors: Kan Ren, Ji ...

  6. Real-Time Bidding with Multi-Agent Reinforcement Learning in Display Advertising 笔记

    文章目录 前言 淘宝展示广告系统 相关工作 多智能体广告竞价 RTB as a Stochastic Game Agent Clusters State Action Reward and Trans ...

  7. 【论文阅读-Bidding】《Feedback Control of Real-Time Display Advertising》

    today 转载于:https://www.cnblogs.com/ai1024/p/9508516.html

  8. SPOJ 962 Intergalactic Map (从A到B再到C的路线)

    [题意]在一个无向图中,一个人要从A点赶往B点,之后再赶往C点,且要求中途不能多次经过同一个点.问是否存在这样的路线.(3 <= N <= 30011, 1 <= M <= 5 ...

  9. 【论文阅读-Bidding】《Real-Time Bidding Algorithms for Performance-Based Display Ad Allocation,2011年,微软》...

    0.摘要 已有的出价策略是投放粒度的,本文给出两种: 1)基于控制论的出价 2)基于历史Bindding Landscape的出价 1.介绍 出价优化的目标:在预算和库存限制下,求得平台利益最大化方案 ...

最新文章

  1. 初学者应该了解的编程陷阱:javascript篇
  2. ADAS在车载导航设备上的应用
  3. PL/SQL在win7/win8 x64位下使用客户端连接oracle
  4. OpenGL 四边形渲染的实例
  5. perl数组硬引用_Perl个人总结
  6. 第五届“强网杯”青少年专项赛盛大开赛
  7. 汇编语言:实现大小写字母转换
  8. 文件I/O实践(2) --文件stat
  9. 还没使用过Web Worker,推荐一款开源工具Workerize,快速上手
  10. 谷歌宣布开源 Live Transcribe 语音识别转文字工具
  11. SQLSERVER中使用函数去掉数据中的空格,批量删除数据中空格、换行符?,替换字段中字符串
  12. C语言程序设计之猜数字游戏(随机数的讲解)
  13. steam 集换式卡牌挂卡软件 ASF Linux服务器搭建
  14. IDEA社区版没有spring Initializr
  15. 18个最好的代码编辑器/IDE工具
  16. 刘未鹏的博中带的技术博客链接
  17. 公众号显示IP归属地,有多少人会现出原形?
  18. sql between包括两端吗?
  19. OneNet数据可视化View页面上的数据过滤器使用介绍
  20. Elastic Job 入门详解

热门文章

  1. java代码实现链表_java单链表代码实现
  2. python没有菜单栏怎么搞mac_Mac 下 sublime 怎么调出顶端菜单栏
  3. python字符串截取方法_如何使用python语言中的字符串方法截取字符串
  4. 太平洋大西洋水流问题如何解决?一文了解图在前端中的应用
  5. [JS-DOM]核心DOM模型(Document,Element,Node)
  6. [Java基础]Set集合概述和特点
  7. [蓝桥杯2019初赛]修改数组-并查集
  8. Strategy(策略)--对象行为型模式
  9. 给定一个n节点的二叉树,写出一个O(n)时间非递归过程,将该树每个节点关键字输出,可以使用一个栈作为辅助数据结构(算法导论第十章10.4-3)
  10. Docker容器实战思维