atcoder ---ID

在Atcoder共和国中,每个城市将被分配一个12位的ID。ID的前6位是该城市所在县的编号,后6位是该城市在其县内建立的顺序。输出所有城市的ID,按城市建立顺序排列。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Problem Statement

In Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.

City i is established in year Yi and belongs to Prefecture Pi.

You can assume that there are no multiple cities that are established in the same year.

It is decided to allocate a 12-digit ID number to each city.

If City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is Pi, and the last six digits of the ID number is x.

Here, if Pi or x (or both) has less than six digits, zeros are added to the left until it has six digits.

Find the ID numbers for all the cities.

Note that there can be a prefecture with no cities.

Constraints

  • 1≤N≤105
  • 1≤M≤105
  • 1≤PiN
  • 1≤Yi≤109
  • Yi are all different.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

N M
P1 Y1
:
PM YM

Output

Print the ID numbers for all the cities, in ascending order of indices (City 1, City 2, …).


Sample Input 1

Copy

2 3
1 32
2 63
1 12

Sample Output 1

Copy

000001000002
000002000001
000001000001
  • As City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.
  • As City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.
  • As City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.

Sample Input 2

Copy

2 3
2 55
2 77
2 99

Sample Output 2

Copy

000002000001
000002000002
000002000003

先整个进行时间的排序,再遍历一遍

#include<cstdio>
#include<algorithm>
using namespace std;
struct ss{
	int rank;
    int p;
    int y;
}a[100005];
int cmp(ss x,ss y){
    if(x.p!=y.p) return x.p<y.p;
    else return x.y<y.y;
}
int main()
{
    int n ,m;
    scanf("%d%d",&n,&m);
    int b[100005];
    for(int i=0;i<m;i++){
    	a[i].rank=i;
        scanf("%d%d",&a[i].p,&a[i].y); 	
        b[i]=a[i].p;
	}
    sort(a,a+m,cmp);
    int f=a[0].p,flag=1;
    int x[100005];
    
    for(int i=0;i<m;i++){
    	if(a[i].p!=f) {flag=1;f=a[i].p;}
    	x[a[i].rank]=flag++;
	}
    // for(int i=0;i<m;i++)
    //    cout<< a[i].rank<<" "<<a[i].p<<" " <<a[i].y<<endl;
    for(int i=0;i<m;i++)
        printf("%06d%06d\n",b[i],x[i]);
    return 0;
}

 

### AtCoder平台的好友系统与团队协作功能 AtCoder作为一个面向编程竞赛爱好者的在线评测系统,在促进用户之间的社交互动方面提供了一定的功能。然而,相较于其他一些具有更全面社交特性的网站,AtCoder的设计更加专注于比赛本身以及个人能力提升。 对于希望在平台上建立联系或者共同参与项目的开发者而言,AtCoder允许用户通过关注机制来追踪感兴趣的人士动态[^1]。当涉及到更为正式的合作形式时,虽然该平台并未内置类似于Scrum Meeting这样的定期会议安排工具用于支持敏捷开发实践中的Code Review活动,但是参与者可以借助外部通讯手段(如Slack、Discord等即时通讯软件)自行组织讨论组来进行代码审查和技术交流[^2]。 至于Git协作特性,这并不是AtCoder的核心服务范围;相反,这类版本控制系统通常由专门的服务提供商如GitHub、GitLab等负责托管和支持。因此,如果目标是在AtCoder之外继续深化基于开源精神下的长期合作,则建议参赛者们考虑将项目迁移到这些更适合管理源码库及其变更历史记录的专业平台上进行维护和发展[^3]。 ```python # 示:如何查看已关注用户的提交记录 import requests def get_following_submissions(user_id): url = f"https://atcoder.jp/users/{user_id}/history" response = requests.get(url) if response.status_code == 200: return response.text else: raise Exception("Failed to fetch data") print(get_following_submissions('example_user')) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值