打表题。。

规律是找出来了 奈何优化不了 。。。。

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <cctype>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#define rap(i, a, n) for(int i=a; i<=n; i++)
#define rep(i, a, n) for(int i=a; i<n; i++)
#define lap(i, a, n) for(int i=n; i>=a; i--)
#define lep(i, a, n) for(int i=n; i>a; i--)
#define rd(a) scanf("%d", &a)
#define rlld(a) scanf("%lld", &a)
#define rc(a) scanf("%c", &a)
#define rs(a) scanf("%s", a)
#define rb(a) scanf("%lf", &a)
#define rf(a) scanf("%f", &a)
#define pd(a) printf("%d\n", a)
#define plld(a) printf("%lld\n", a)
#define pc(a) printf("%c\n", a)
#define ps(a) printf("%s\n", a)
#define MOD 2018
#define LL long long
#define ULL unsigned long long
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _ ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;
const int maxn = , INF = 0x7fffffff, LL_INF = 0x7fffffffffffffff;
int way[maxn][maxn];
int sta[maxn];
void solve()
{
way[][] = ;
for(int i = ; i <= ; i *= )
{
int k = i >> ;
for(int x = ; x <= k; x++)
for(int y = ; y <= k; y++)
{
way[x + k][y + k] = way[x][y];
way[x + k][y] = way[x][y + k] = way[x][y] + k;
}
}
} int main()
{
int T, n, k;
solve();
cin >> T;
while(T--)
{
int cnt = ;
cin >> n >> k;
// if((n & 1) || !(n & 1) && k > n - 1)
// {
// cout << "Impossible" << endl;
// continue;
// }
for (int i = ; i <= n; i++)
{
bool flag = ;
for (int j = ; j <= n; j++)
{
if(way[i][j] > n)
{
flag = ; break;
}
}
if(!flag) sta[cnt++] = i;
}
if(cnt < k)
{
cout << "Impossible" << endl;
continue;
}
for(int i = ; i < k; i++)
for(int j = ; j <= n; j++)
printf("%d%s", way[sta[i]][j], (j == n ? "\n" : " ")); } return ;
}

Tournament ZOJ - 4063 (青岛区域赛 F 打表)的更多相关文章

  1. 2016ACM青岛区域赛题解

    A.Relic Discovery_hdu5982 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Jav ...

  2. ACM/ICPC2016 青岛区域赛

    A(hdu5982).(模拟) 题意:输入n对数,将每对数相乘并相加 分析:模拟 B(hdu5983).(模拟) 题意:给你一个二阶魔方,问能否通过一次旋转使得给定魔方的每个面颜色相同 分析:模拟 C ...

  3. 2016 年 ACM/ICPC 青岛区域赛 Problem C Pocky

    昨晚乱入学弟的训练赛,想了一下这个题.推导的过程中,加深了对公理化的概率论理解.$\newcommand{\d}{\mathop{}\!\mathrm{d}}$ 解法一 考虑 $ d < L$ ...

  4. 2019icpc徐州区域赛F

    F. The Answer to the Ultimate Question of Life, The Universe, and Everything. 我的第一道真·打表题 这次是真的打表啊,不是 ...

  5. 2016青岛区域赛.Coding Contest(费用流 + 概率计算转换为加法计算)

    Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  6. HDU 4818 RP problem (高斯消元, 2013年长春区域赛F题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4818 深深地补一个坑~~~ 现场赛坑在这题了,TAT.... 今天把代码改了下,过掉了,TAT 很明显 ...

  7. 高精度乘法-17南宁区域赛F -The Chosen One

    题目大意:给你一个n,然后从1~n隔一个选一个,挑出一个集合然后从集合中继续隔一个挑一个,直到只有一个数,问最后一个数是多少?2<=n<=1050 例如n=5,先选出2,4最后选择4.n= ...

  8. UVALive - 7740 Coding Contest 2016 青岛区域赛 (费用流)

    题意:每个点i有\(s_i\)个人和\(b_i\)份食物,每个人都要找到一份食物.现在有M条有向边,从点i到点j,容量为c,第一次走过不要紧,从第二次开始就要承担\(p(0<p<1)\)的 ...

  9. 17 南宁区域赛 F - The Chosen One 【规律】

    题目链接 https://nanti.jisuanke.com/t/19972 题意 给出一个n 然后将 n 个数 标号为 1 -> n 按顺序排列 每次抽掉 奇数位的数 然后求最后剩下那个数字 ...

随机推荐

  1. SSH(poderosa)を使って、さくらのMySQLサーバーに接続する方法

    SSH(poderosa)を使って.さくらのMySQLサーバーに接続する方法の覚書. 現在のさくらサーバーでは.新規ユーザーはTELNETが使えない.なので.データベースをコマンドラインで操作するには ...

  2. 【fetch跨域请求】cors

    当使用fetch 发起跨域请求时,CORS(跨域资源共享Cross-origin resource sharing) 请求fetch const body = {name:"Good boy ...

  3. Leetcode -- 258 数位相加

    258. Given a non-negative integer num, repeatedly add all its digits until the result has only one d ...

  4. Daily Scrum 12.19

    Member Task on 12.19 Task on 12.20 仇栋民 请假 完成Task972 : 完成活动评分基础功能 康家华 完成 Task1004 : 百度map UI优化 完成Task ...

  5. Python+Appium学习篇之WebView处理

    1.认识WebView 实例说明: 当你打开百度阅读APP→VIP全站去广告→用自带的 UI Automator去定位里面的元素,如图: 不管你去定位  '规则详情'  '开通'等等,都会定位不到,只 ...

  6. semantic-ui 按钮

    1.基础按钮: 使用button.div.span.i等标签,将其class设置为"ui button",显示的就是最基础的按钮样式. <i class="ui b ...

  7. 【问题解决方案】从 Anaconda Prompt 或 Jupyter Notebook 终端进入Python后重新退出到命令状态

    从 Anaconda Prompt 或 Jupyter Notebook 终端进入Python后重新退出到命令状态 退出Python:exit() 或者 Ctrl+z 例子一枚 默认打开的是3.7,需 ...

  8. 爬虫——xpath

    1.什么是xpath? Xpath,全称XML Path Language,即XML路径语言.它是一门在XML之后查找信息的语言,也同样适用于HTML文档的搜索.在做爬虫的时候,我们用XPath语言来 ...

  9. PAT 7-12 拯救007

    在老电影“007之生死关头”(Live and Let Die)中有一个情节,007被毒贩抓到一个鳄鱼池中心的小岛上,他用了一种极为大胆的方法逃脱 —— 直接踩着池子里一系列鳄鱼的大脑袋跳上岸去!(据 ...

  10. 监控系统对比 Ganglia vs Open-falcon vs Prometheus vs Zabbix vs Nagios vs PandoraFMS

    Zabbix vs Nagios vs PandoraFMS: an in depth comparison - Pandora FMS - The Monitoring Bloghttps://bl ...