結果
| 問題 |
No.370 道路の掃除
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-17 12:44:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 403 bytes |
| コンパイル時間 | 1,008 ms |
| コンパイル使用メモリ | 90,020 KB |
| 最終ジャッジ日時 | 2025-01-10 12:41:39 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 WA * 4 |
ソースコード
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace std;
using ll = long long;
ll n, m, d[1010], e[1010];
int main()
{
cin >> n >> m;
for (int i = 0; i < m; ++i)
cin >> d[i];
ll ans = 1 << 30;
for (int i = 0; i < m - n + 1; ++i)
{
ans = min(ans, min(abs(d[i + n - 1]), abs(d[i])) + d[i + n - 1] - d[i]);
}
cout << ans << endl;
return 0;
}