Submission #116207

# Submission time Handle Problem Language Result Execution time Memory
116207 2019-06-11T09:09:43 Z Arturgo Stove (JOI18_stove) C++14
100 / 100
51 ms 1920 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> decs;

int main() {
  ios_base::sync_with_stdio(false);
  int nbInvites, nbTours;
  cin >> nbInvites >> nbTours;

  int derTemps = 0;
  for(int iInvite = 0;iInvite < nbInvites;iInvite++) {
    int temps;
    cin >> temps;

    if(iInvite != 0)
      decs.push_back(temps - derTemps - 1);
    
    derTemps = temps;
  }

  sort(decs.begin(), decs.end());
  
  int sommeDecs = nbInvites;
  for(int iTour = 0;iTour < nbInvites - nbTours;iTour++) {
    sommeDecs += decs[iTour];
  }

  cout << sommeDecs << endl;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 512 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 512 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 22 ms 1920 KB Output is correct
17 Correct 51 ms 1912 KB Output is correct
18 Correct 22 ms 1920 KB Output is correct
19 Correct 21 ms 1840 KB Output is correct
20 Correct 22 ms 1920 KB Output is correct
21 Correct 22 ms 1920 KB Output is correct
22 Correct 21 ms 1920 KB Output is correct
23 Correct 21 ms 1920 KB Output is correct
24 Correct 22 ms 1920 KB Output is correct