結果
| 問題 |
No.615 集合に分けよう
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-23 18:09:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 576 bytes |
| コンパイル時間 | 669 ms |
| コンパイル使用メモリ | 70,204 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-27 05:53:13 |
| 合計ジャッジ時間 | 4,403 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 5 |
| other | WA * 26 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int N, K;
cin >> N >> K;
long nums[N];
for(int i = 0; i < N; i++){
cin >> nums[i];
cout << i << endl;
}
sort(nums, nums + N);
long differences[N - 1];
for(int i = 0; i < N - 1; i++){
differences[i] = nums[i + 1] - nums[i];
cout << i << endl;
}
sort(differences, differences + N - 1);
long ans = 0;
for(int i = 0; i < N - K; i++){
ans += differences[i];
cout << i << endl;
}
cout << ans << endl;
}