当前位置: 首页 > news >正文

Rudolf and the Ball Game

传送门

题意

思路

暴力枚举每一个妆台的转换条件

code

#include<iostream>
#include<cstdio>
#include<stack>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#define int long long
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define  long long
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int INF = 1e18 + 10;
const int N = 1e5 + 10;
const int M = 1e7 + 10;
const int mod = 1e9 + 7;
int n, m, k, ans;
int qcal(int a, int b) { int res = 1; while (b) { if (b & 1) res = res * a % mod; b >>= 1; a = a * a % mod; } return res; }
int a[N], b[N];
bool is_prime(int n) { if (n < 2) return false; for (int i = 2; i <= n / i; i++) { if (n % i == 0) { return false; } }return true; }
int f[1010][1010];
void gzy()
{}
signed main()
{IOS;int _ = 1; cin >> _;while (_--) gzy();return 0;
}
/***  ┏┓   ┏┓+ +* ┏┛┻━━━┛┻┓ + +* ┃       ┃* ┃   ━   ┃ ++ + + +*  ████━████+*  ◥██◤ ◥██◤ +* ┃   ┻   ┃* ┃       ┃ + +* ┗━┓   ┏━┛*   ┃   ┃ + + + +Code is far away from  *   ┃   ┃ + bug with the animal protecting*   ┃    ┗━━━┓ 神兽保佑,代码无bug *   ┃  	    ┣┓*    ┃        ┏┛*     ┗┓┓┏━┳┓┏┛ + + + +*    ┃┫┫ ┃┫┫*    ┗┻┛ ┗┻┛+ + + +*/

很可惜 这样T了

原因在每次都memset了1010*1010

题目说了n*m <= 2e5 所以我们应该手写 清零

#include<iostream>
#include<cstdio>
#include<stack>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#define int long long
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define  long long
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int INF = 1e18 + 10;
const int N = 1e5 + 10;
const int M = 1e7 + 10;
const int mod = 1e9 + 7;
int n, m, k, ans;
int qcal(int a, int b) { int res = 1; while (b) { if (b & 1) res = res * a % mod; b >>= 1; a = a * a % mod; } return res; }
int a[N], b[N];
bool is_prime(int n) { if (n < 2) return false; for (int i = 2; i <= n / i; i++) { if (n % i == 0) { return false; } }return true; }
int f[1010][1010];
void gzy()
{cin >> n >> m >> k;for(int i = 0;i <= m;i ++)for(int j = 0;j <= n;j ++)f[i][j] = 0;f[0][k] = 1;for(int i = 1;i <= m;i ++){int tmp;char ch; cin >> tmp >> ch;for(int j = 1;j <= n;j ++){if(ch == '0') {if((j+n-tmp) % n == 0) f[i][j] = max(f[i][j],f[i-1][n]);else f[i][j] = max(f[i][j],f[i-1][(j+n-tmp) % n]);}else if(ch == '1'){if((j+tmp) % n == 0) f[i][j] = max(f[i][j],f[i-1][n]);else f[i][j] = max(f[i][j],f[i-1][(j+tmp) % n]);}else{if((j+n-tmp) % n == 0) f[i][j] = max(f[i][j],f[i-1][n]);else f[i][j] = max(f[i][j],f[i-1][(j+n-tmp) % n]);if((j+tmp) % n == 0) f[i][j] = max(f[i][j],f[i-1][n]);else f[i][j] = max(f[i][j],f[i-1][(j+tmp) % n]);}}}set<int> se;int cnt = 0;for(int i = 1;i <= n;i ++)if(f[m][i]){cnt ++;se.insert(i);}cout << cnt << endl;for(auto c:se) cout << c << ' ';cout << endl;}
signed main()
{IOS;int _ = 1; cin >> _;while (_--) gzy();return 0;
}
/***  ┏┓   ┏┓+ +* ┏┛┻━━━┛┻┓ + +* ┃       ┃* ┃   ━   ┃ ++ + + +*  ████━████+*  ◥██◤ ◥██◤ +* ┃   ┻   ┃* ┃       ┃ + +* ┗━┓   ┏━┛*   ┃   ┃ + + + +Code is far away from  *   ┃   ┃ + bug with the animal protecting*   ┃    ┗━━━┓ 神兽保佑,代码无bug *   ┃  	    ┣┓*    ┃        ┏┛*     ┗┓┓┏━┳┓┏┛ + + + +*    ┃┫┫ ┃┫┫*    ┗┻┛ ┗┻┛+ + + +*/

http://www.lryc.cn/news/318687.html

相关文章:

  • 计算机毕业设计-基于大数据技术下的高校舆情监测与分析
  • WPF使用LiveCharts画图时,横坐标转换成时间
  • Qt客户端开发的技术难点
  • 杰理AD155儿童玩具语音集成电路
  • git bash 命令行反应慢、卡顿(定位出根本原因)
  • Android 启动service(Kotlin)
  • Windows蓝牙驱动开发之模拟HID设备(一)(把Windows电脑模拟成蓝牙鼠标和蓝牙键盘等设备)
  • LlamaParse: 高效的PDF文件RAG解析工具
  • platform设备注册驱动模块的测试
  • 鸿蒙Harmony应用开发—ArkTS声明式开发(容器组件:ListItemGroup)
  • Docker:常用命令
  • 如何搭建“Docker Registry私有仓库,在CentOS7”?
  • DBA面试题:MySQL缓存池LRU算法做了哪些改进?
  • idea+vim+pycharm的块选择快捷键
  • ansible 部署FATE集群单边场景
  • 融入Facebook的世界:探索数字化社交的魅力
  • stm32-定时器输出比较PWM
  • Redis对过期key的删除策略
  • http的body格式
  • Java Web开发从0到1
  • 002——编译鸿蒙(Liteos -a)
  • Ansible--详解
  • Django和Mysql数据库
  • [蓝桥杯]-最大的通过数-CPP-二分查找、前缀和
  • 安卓UI面试题 26-30
  • CPU、GPU、IPU、NPU、TPU、LPU、MCU、MPU、SOC、DSP、FPGA、ASIC、GPP、ECU、
  • 鸿蒙车载原生开发,拓展新版图
  • 15届蓝桥杯第二期模拟赛题单详细解析
  • mysql统计数据库大小
  • centos防火墙firewall-cmd限定特定的ip访问