Submission #903934

# Submission time Handle Problem Language Result Execution time Memory
903934 2024-01-11T14:52:03 Z zhasyn Stove (JOI18_stove) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
int arr[100010];
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  	int n, k, ans = 0;
  	cin >> n >> k;
  	for(int i = 0; i < n; i++){
  		cin >> arr[i];
  	}
  	sort(arr, arr + n);
  	set <int> st;
  	int cur = arr[0], fir = arr[0], cnt = 1;
  	for(int i = 1; i < n; i++){
  		if(arr[i] - cur <= 1) cur = arr[i];
  		else{
  			ans += (cur - fir + 1);
  			cnt++;
  			st.insert({arr[i] - cur - 1});
  			cur = fir = arr[i];
  		}
  	}
  	
  	cout << ans;
  	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -