結果
問題 | No.1110 好きな歌 |
ユーザー |
|
提出日時 | 2020-07-10 21:28:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 374 ms / 5,000 ms |
コード長 | 352 bytes |
コンパイル時間 | 794 ms |
コンパイル使用メモリ | 70,388 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2024-10-11 07:49:31 |
合計ジャッジ時間 | 11,590 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int N,D; pair<int,int>A[2<<17]; int ans[2<<17]; main() { cin>>N>>D; for(int i=0;i<N;i++) { cin>>A[i].first; A[i].second=i; } sort(A,A+N); int id=0; for(int i=0;i<N;i++) { while(A[id].first+D<=A[i].first)id++; ans[A[i].second]=id; } for(int i=0;i<N;i++)cout<<ans[i]<<endl; }