cf#323-div2-A. Asphalting Roads-简单模拟
来源:互联网 发布:新商盟软件下载 编辑:程序博客网 时间:2024/06/06 18:47
给一个n,n条竖的路,n条水平的路
给你n*n个点,是路的交点,工人会按找给的点的顺序,到达该点。 一天走一个点
如果该点任一路被铺过沥青,离开。
如果该点横竖的路都没铺过沥青,把2条路都铺上
输出铺沥青时候的 天数
直接模拟就好。。。
#include <cstdio>#include <cmath>#include <cstring>#include <string>#include <algorithm>#include <iostream>#include <queue>#include <map>#include <set>#include <vector>using namespace std;int heng[51];int shu[51];struct node{int l,r;};node tm[51*51];int main(){int n; int i,j;scanf("%d",&n);int a,b;for (i=1;i<=n*n;i++){scanf("%d%d",&a,&b);tm[i].l=a;tm[i].r=b;}int line=0;for (i=1;i<=n*n;i++){a=tm[i].l;b=tm[i].r;if (!heng[a]&&!shu[b]){if (line) printf(" ");printf("%d",i);line=1;heng[a]=shu[b]=1;}}printf("\n"); return 0;}
0 0
- cf#323-div2-A. Asphalting Roads-简单模拟
- Codeforces Round #323 A Asphalting Roads
- A. Asphalting Roads
- Codeforces 583A Asphalting Roads
- codeforces 583A Asphalting Roads
- Codeforces Round #323 (Div. 2) 583A. Asphalting Roads
- Codeforces Round #323 (Div. 2) A. Asphalting Roads
- Codeforces Round #323 (Div. 2) A. Asphalting Roads
- Codeforces Round #323 (Div. 2)A. Asphalting Roads
- cf#323-div2-B. Robot's Task-简单模拟
- Asphalting Roads
- 【Codeforces Round 323 (Div 2)A】【水题】Asphalting Roads 行列之进行首次操作
- Code Forces 583 A. Asphalting Roads(水~)
- cf div2 191 A
- cf 185div2 A
- CF 287 div2 A
- Asphalting Roads [水题]
- CF 171(div2)A
- EDA设计:kicad使用及PCB推挤布线,spice电路仿真等
- JVM中的垃圾收集算法
- hdu 5497 Inversion 求逆序对 树状数组
- C++primer学习:顺序容器(3)
- JVM中的垃圾收集器
- cf#323-div2-A. Asphalting Roads-简单模拟
- 在Ubuntu Server 14.04上源码安装Odoo 9.0
- hibernate 配置数据库方言
- leetCode:LRU Cache TreeMap应用
- Android四大基本组件——Activity
- c++外观模式
- cf#323-div2-B. Robot's Task-简单模拟
- 测试天气查询API(JAVA版百度api、C#版APIX)未处理json
- Android WebView 支持H5 DOM Storage