Description

City X consists of n vertical and n horizontal infinite roads, forming n × n intersections. Roads (both vertical and horizontal) are numbered from 1 to n, and the intersections are indicated by the numbers of the roads that form them.

Sand roads have long been recognized out of date, so the decision was made to asphalt them. To do this, a team of workers was hired and a schedule of work was made, according to which the intersections should be asphalted.

Road repairs are planned for n2 days. On the i-th day of the team arrives at the i-th intersection in the list and if none of the two roads that form the intersection were already asphalted they asphalt both roads. Otherwise, the team leaves the intersection, without doing anything with the roads.

According to the schedule of road works tell in which days at least one road will be asphalted.

Input

The first line contains integer n (1 ≤ n ≤ 50) — the number of vertical and horizontal roads in the city.

Next n2 lines contain the order of intersections in the schedule. The i-th of them contains two numbers hi, vi (1 ≤ hi, vi ≤ n), separated by a space, and meaning that the intersection that goes i-th in the timetable is at the intersection of the hi-th horizontal and vi-th vertical roads. It is guaranteed that all the intersections in the timetable are distinct.

Output

In the single line print the numbers of the days when road works will be in progress in ascending order. The days are numbered starting from 1.

Sample Input

Input
2
1 1
1 2
2 1
2 2
Output
1 4 
Input
1
1 1
Output
1 

Hint

In the sample the brigade acts like that:

  1. On the first day the brigade comes to the intersection of the 1-st horizontal and the 1-st vertical road. As none of them has been asphalted, the workers asphalt the 1-st vertical and the 1-st horizontal road;
  2. On the second day the brigade of the workers comes to the intersection of the 1-st horizontal and the 2-nd vertical road. The 2-nd vertical road hasn't been asphalted, but as the 1-st horizontal road has been asphalted on the first day, the workers leave and do not asphalt anything;
  3. On the third day the brigade of the workers come to the intersection of the 2-nd horizontal and the 1-st vertical road. The 2-nd horizontal road hasn't been asphalted but as the 1-st vertical road has been asphalted on the first day, the workers leave and do not asphalt anything;
  4. On the fourth day the brigade come to the intersection formed by the intersection of the 2-nd horizontal and 2-nd vertical road. As none of them has been asphalted, the workers asphalt the 2-nd vertical and the 2-nd horizontal road.

题目意思:有n条横向的路和n条纵向的路,交叉得到n*n个路口,要修理路到某个路口,只有当形成这个路口的两条路都没有被修过的时候,这两条路才会被修,问那一天修过路。

解题思路:。。。。。。要什么思路分明是水题,可以我看不懂英语啊,英语是不可能看懂的,这辈子都不可能了(还是好好学吧,捂脸)

上代码:

 #include<stdio.h>
#include<string.h>
int main()
{
int n,x,y,k,i;
int a[],s1[],s2[];
scanf("%d",&n);
k=;
memset(s1,,sizeof(s1));
memset(s2,,sizeof(s2));
for(i=;i<=n*n;i++)
{
scanf("%d%d",&x,&y);
if(s1[x]==&&s2[y]==)
{
s1[x]=;
s2[y]=;
a[k++]=i;
}
}
for(i=;i<k;i++)
{
printf("%d ",a[i]);
}
printf("\n");
return ;
}

Asphalting Roads(翻译!)的更多相关文章

  1. Codeforces 583 DIV2 Asphalting Roads 模拟

    原题链接:http://codeforces.com/problemset/problem/583/A 题意: 很迷很迷,表示没看懂..但是你看样例就秒懂了 题解: 照着样例模拟就好 代码: #inc ...

  2. Codeforces Round #323 (Div. 2) A 水

    A. Asphalting Roads time limit per test 1 second memory limit per test 256 megabytes input standard ...

  3. Codeforces Round #323 (Div. 2)

    被进爷坑了,第二天的比赛改到了12点 水 A - Asphalting Roads /************************************************ * Author ...

  4. ACM团队周赛题解(2)

    拉了CF583和CF486的两套div2题目 还是先贴宏定义部分 #define MAXN 1000000+5#define MOD 1000000007#define PI (acos(-1.0)) ...

  5. MCM/ICM2018美国大学生数学建模大赛D题翻译

    MCM/ICM2018美国大学生数学建模大赛D题翻译 2018年ICM问题D: 非使用汽油并在使用电力行驶的汽车(电量非空的) 由于环境和经济的原因,全球都在减少使用化石燃料,包括汽车汽油. 无论是受 ...

  6. 翻译Lanlet2

    Here is more information on the basic primitives that make up a Lanelet2 map. Read here for a primer ...

  7. USACO Building Roads

    洛谷 P2872 [USACO07DEC]道路建设Building Roads 洛谷传送门 JDOJ 2546: USACO 2007 Dec Silver 2.Building Roads JDOJ ...

  8. 洛谷 P2872 [USACO07DEC]道路建设Building Roads 题解

    P2872 [USACO07DEC]道路建设Building Roads 题目描述 Farmer John had just acquired several new farms! He wants ...

  9. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

随机推荐

  1. 01.centos7环境准备

    博客为日常工作学习积累总结: 1.环境准备: 系统版本:CentOS-7-x86_64-Minimal-1810.iso 运行环境:虚拟机windows上的VM 15 系统安装:参照老男孩运维要求 2 ...

  2. 运行Delphi XE10的MongoDB例程,测试Delphi插入记录性能

    Delphi XE10支持MongoDB的数据库,提供了个例子restaurants可批量导入数据. 本文对比Delphi例子与MongoDB自带的mongoimport导入批量数据的性能. 步骤: ...

  3. espcomm_send_command: didn't receive command response | espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed |arduino wemos d1 无法上传

    espcomm_send_command: didn't receive command response espcomm_send_command(FLASH_DOWNLOAD_BEGIN) fai ...

  4. 常见的Content-Type类型

    Content-Type说明 MediaType,即是Internet Media Type,互联网媒体类型:也叫做MIME类型, 在Http协议消息头中,使用Content-Type来表示具体请求中 ...

  5. 旭日图(sunburst chart)绘制:R语言 & excel

    旭日图(sunburst chart)也叫太阳图,一种圆环镶接图,每一个圆环就代表了同一级别的比例数据,离原点越近的圆环级别越高,最内层的圆表示层次结构的顶级.除了圆环外,旭日图还有若干从原点放射出去 ...

  6. 20155215 2016-2017-2 《Java程序设计》第10周学习总结

    20155215 2016-2017-2 <Java程序设计>第10周学习总结 教材学习内容总结 网络概论 - 网络是能够彼此通信的计算机的总和. - 网络分为局域网和广域网. - 按照计 ...

  7. 20155231 实验三 敏捷开发与XP实践

    20155231 实验三 敏捷开发与XP实践 实验内容 XP基础 XP核心实践 相关工具 实验要求 没有Linux基础的同学建议先学习<Linux基础入门(新版)><Vim编辑器&g ...

  8. echarts 柱状图移除圆角

    itemStyle: { normal: { color: '#59519f', barBorderColor: '#59519f', barBorderWidth: 6, barBorderRadi ...

  9. MySQL优化Explain命令简介(二)

    type列 MySQL手册上注明type列用于描述join type,不过我们认为把这一列视为对access type--即MySQL决定如何在表中寻找数据的方式的描述,更加合适一些,以下所示从最坏情 ...

  10. 【mysql经典题目】行转列

    参考:http://www.cnblogs.com/h07061108/p/mysql_questions.html#3806338 实现如下效果 CREATE TABLE IF NOT EXISTS ...