# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
711410 | 2023-03-16T21:09:39 Z | thimote75 | Stove (JOI18_stove) | C++14 | 1 ms | 300 KB |
#include <bits/stdc++.h> using namespace std; #define num long long int main () { int nbNodes, nbVal; cin >> nbNodes >> nbVal; nbVal --; vector<num> deltas; int last = 0; for (int i = 0; i < nbNodes; i ++) { int curr; cin >> curr; if (last != 0) deltas.push_back(curr - last - 1); last = curr; deltas.push_back(1); } sort(deltas.rbegin(), deltas.rend()); num answer = 0; for (int i = nbVal; i < deltas.size(); i ++) answer += deltas[i]; cout << answer; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Incorrect | 1 ms | 296 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Incorrect | 1 ms | 296 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 300 KB | Output is correct |
5 | Incorrect | 1 ms | 296 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |