結果
| 問題 |
No.1110 好きな歌
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-16 01:10:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 388 ms / 5,000 ms |
| コード長 | 506 bytes |
| コンパイル時間 | 950 ms |
| コンパイル使用メモリ | 76,176 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2024-12-15 10:54:44 |
| 合計ジャッジ時間 | 13,744 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n,d;cin>>n>>d;
vector<pair<int,int>> A(n);
for(int i = 0; n > i; i++){
cin>>A[i].first;
A[i].second = i;
}
sort(A.begin(),A.end());
int nw = 0;
vector<pair<int,int>> B(n);
for(int i = 0; n > i; i++){
while(A[i].first-A[nw].first >= d){
nw++;
}
B[i] = {A[i].second,nw};
}
sort(B.begin(),B.end());
for(int i = 0; n > i; i++){
cout << B[i].second << endl;
}
}