結果
| 問題 | No.370 道路の掃除 |
| コンテスト | |
| ユーザー |
btk
|
| 提出日時 | 2016-05-13 23:45:48 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 392µs | |
| コード長 | 413 bytes |
| 記録 | |
| コンパイル時間 | 1,007 ms |
| コンパイル使用メモリ | 187,152 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-17 02:17:52 |
| 合計ジャッジ時間 | 3,045 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);}}init;
int main() {
int n,m;
cin >> n >> m;
vector<int> d(m);
for(auto& it : d)cin >> it;
sort(d.begin(),d.end());
int res=114514;
for(int i = 0,j= n - 1; j < m; i++,j++){
res=min(res,min(abs(d[i]),abs(d[j]))+abs(d[i]-d[j]));
}
cout<< res << endl;
return 0;
}
btk