CodeForces 618B Guess the Permutation
只要找出当前没用过的数字中,大于或等于当前这一列的最大值就可以
- #include<cstdio>
- #include<cstring>
- #include<cmath>
- #include<vector>
- #include<algorithm>
- using namespace std;
- const int maxn=;
- int n;
- int x[maxn][maxn];
- int ans[maxn];
- int flag[maxn];
- int main()
- {
- scanf("%d",&n);
- for(int i=; i<=n; i++)
- for(int j=; j<=n; j++)
- scanf("%d",&x[i][j]);
- memset(flag,,sizeof flag);
- for(int j=; j<=n; j++)
- {
- int Max=-;
- for(int i=; i<=n; i++) Max=max(Max,x[i][j]);
- for(int i=Max; i<=n; i++)
- {
- if(flag[i]==)
- {
- ans[j]=i;
- flag[i]=;
- break;
- }
- }
- }
- for(int i=; i<=n; i++) printf("%d ",ans[i]);
- printf("\n");
- return ;
- }
CodeForces 618B Guess the Permutation的更多相关文章
- 【CodeForces 618B】Guess the Permutation
题 题意 有个1到n的一个全排列,告诉你第i个数和全部n个数相比的较小的是哪个,和自己相比时为0,于是有个主对角线为0的矩阵,求原数列 分析 我的想法是,给我们的每一行之和按大小排一下,就知道第i个数 ...
- Codeforces 691D Swaps in Permutation
Time Limit:5000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Prac ...
- Codeforces 500B. New Year Permutation[连通性]
B. New Year Permutation time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- codeforces 500B.New Year Permutation 解题报告
题目链接:http://codeforces.com/problemset/problem/500/B 题目意思:给出一个含有 n 个数的排列:p1, p2, ..., pn-1, pn.紧接着是一个 ...
- codeforces B. Levko and Permutation 解题报告
题目链接:http://codeforces.com/problemset/problem/361/B 题目意思:有n个数,这些数的范围是[1,n],并且每个数都是不相同的.你需要构造一个排列,使得这 ...
- 【搜索】【并查集】Codeforces 691D Swaps in Permutation
题目链接: http://codeforces.com/problemset/problem/691/D 题目大意: 给一个1到N的排列,M个操作(1<=N,M<=106),每个操作可以交 ...
- [Codeforces 864D]Make a Permutation!
Description Ivan has an array consisting of n elements. Each of the elements is an integer from 1 to ...
- Codeforces 785E. Anton and Permutation
题目链接:http://codeforces.com/problemset/problem/785/E 其实可以CDQ分治... 我们只要用一个数据结构支持单点修改,区间查询比一个数大(小)的数字有多 ...
- Codeforces 804E The same permutation(构造)
[题目链接] http://codeforces.com/contest/804/problem/E [题目大意] 给出一个1到n的排列,问每两个位置都进行一次交换最终排列不变是否可能, 如果可能输出 ...
随机推荐
- curl 测试web站点的响应时间
curl -s -w "\n"::%{time_namelookup}::%{time_connect}::%{time_starttransfer}::%{time_total} ...
- Enum 枚举基础
1 定义一个枚举 enum Weekend { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday } 2 得到每个枚举值 f ...
- Ubuntu配置eclipse
1.安装jdk 去官网下载最新版jdk,目前是 jdk-8u45-linux-x64.tar.gz 创建Java的目标路径文件夹,这里我们放在/usr/lib/jvm下面.在终端下操作: sudo m ...
- GameUnity 2.0 文档(五) 人工智能之---------------Flocking算法 (聚集,分散,列队 )
AI是游戏的灵魂,是人物的智商,是让玩家觉得游戏是否幼稚的重要判断功能,下面我将介绍国外流行,国内不行的,ai算法. 主要介绍 Flocking 和 Reciprocal Velocity Obs ...
- CodeForces 687A NP-Hard Problem(二分图判定)
这本来一个挺简单的题呢,结果让我给想复杂了,二分图就是把图分成了两部分,然后不同颜色各一边,肯定是满足题目中说的边和点的条件的,真是犯二了.. 代码如下: #include<iostream&g ...
- 解决IIS网站.woff 404 (Not Found)问题
一.在没有权限操作IIS管理器的情况下,在Web.config中的system.webServer节点进行如下配置: <system.webServer> <staticConten ...
- Viewpager以及ViewPagerIndicator的相关使用
ViewPagerIndicator开源框架可以用来在ViewPager上方做标题,可以在ViewPager下方做跟随移动的小圆点,这个类库必须和自己的项目在电脑的同一磁盘盘符下,比如都在D盘或者E盘 ...
- Ubuntu 14.04 待机死机问题原来是自己改了这个配置
使用专有驱动没问题.使用开源驱动就会死机.驱动还是厂商的好@@
- 未能读取并闩锁页 (1:xxxxx)(用闩锁类型 SH)
设置数据库为紧急模式 停掉SQL Server服务: 把应用数据库的数据文件XXX_Data.mdf移走: 重新建立一个同名的数据库XXX: 停掉SQL服务: 把原来的数据文件再覆盖回来: 运行以下语 ...
- UL/LI
如何用CSS制作横向菜单 让ul li横向排列及圆点处理 我们先建立一个无序列表,来建立菜单的结构.代码是: <ul><li><a href="1&quo ...