結果
| 問題 |
No.2662 Installing Cell Towers
|
| ユーザー |
umezo
|
| 提出日時 | 2024-03-06 23:39:42 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 560 bytes |
| コンパイル時間 | 3,160 ms |
| コンパイル使用メモリ | 248,208 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-29 18:37:47 |
| 合計ジャッジ時間 | 4,483 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n,m;
cin>>n>>m;
vector<ll> A(n+2);
ll geta=0;
rep(i,m){
ll p,q;
cin>>p>>q;
A[p+1]-=2;
A[max(1LL,p-q+1)]+=1;
A[min(p+q+1,n+1)]+=1;
geta+=max(0LL,q-p);
}
ll now=0;
for(int i=1;i<=n;i++){
A[i]+=A[i-1];
now+=A[i];
if(i>1) cout<<" ";
cout<<now+geta;
}
cout<<endl;
return 0;
}
umezo