結果
問題 |
No.370 道路の掃除
|
ユーザー |
![]() |
提出日時 | 2025-03-14 21:10:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 690 bytes |
コンパイル時間 | 1,798 ms |
コンパイル使用メモリ | 164,588 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-14 21:10:41 |
合計ジャッジ時間 | 2,970 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 19 |
ソースコード
#include <bits/stdc++.h> #define int long long //#define USE_FREOPEN //#define MUL_TEST #define FILENAME "clean" using namespace std; int a[1005]; void solve() { int n,m; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> a[i]; } sort(a + 1,a + n + 1); int minn = 9e18; for (int i = 1; i <= m - n + 1; i++) { minn = min(minn,abs(a[i]) + a[i + n - 1] - a[i]); } cout << minn << '\n'; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #ifdef USE_FREOPEN freopen(FILENAME ".in","r",stdin); freopen(FILENAME ".out","w",stdout); #endif int _ = 1; #ifdef MUL_TEST cin >> _; #endif while (_--) solve(); _^=_; return 0^_^0; }