結果

問題 No.1137 Circles
ユーザー kotatsugame
提出日時 2020-07-27 01:33:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 76,252 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 19:49:18
合計ジャッジ時間 2,418 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N;
main()
{
	cin>>N;
	vector<pair<int,int> >T(2*N);
	for(int i=0;i<N;i++)
	{
		int x,r;cin>>x>>r;
		T[i*2]=make_pair(x-r,1);
		T[i*2+1]=make_pair(x+r,-1);
	}
	int ans=0,cnt=0;
	sort(T.begin(),T.end());
	for(pair<int,int>p:T)
	{
		cnt+=p.second;
		if(ans<cnt)ans=cnt;
	}
	cout<<ans<<endl;
}
0