답안 #665842

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
665842 2022-11-27T13:42:54 Z Bogdan1110 Stove (JOI18_stove) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define FAST {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define FILES {freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);}
#define ll long long
#define ull unsigned long long
#define pqueue priority_queue
#define pb push_back
#define fi first
#define se second
#define ld long double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) (a).begin(), (a).end()
#define mp make_pair 
#define vii vector<int>
#define vll vector<long long>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
*/
// order_of_key -> # less than k
// find_by_order -> k-th element
// pq max element                                          

void files() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

const double eps = 0.00000001;
const int NMAX = 200010;
const ll inf = 1000000000000010;
const ll modi = 15485863 ;



void solve() {
	int n,k;
	cin >>n >>k;
	vector<ll>v(n);
	for (int i = 0 ; i < n ; i++ ) {
		cin >> v[i];
	}		
	ll tot = n;
	pqueue<int>pq;
	for (int i = 1 ; i < n ; i++ ) {
		pq.push(-v[i]+v[i-1]+1);
	}
	
	for (int i = 0 ; i < n-k; i++ ) {
		tot -= pq.top();
		pq.pop();
	}
	cout << tot <<endl;
}

int main () {
    FAST
    int t=1;

    /*
    cin >> t;
    //*/

    int i = 1;
    while(t--) {
        //cout << "Case " << i++ << ": " ;
        solve();
    }
}        
 

Compilation message

stove.cpp:77:1: error: extended character   is not valid in an identifier
   77 |  
      | ^
stove.cpp: In function 'int main()':
stove.cpp:71:9: warning: unused variable 'i' [-Wunused-variable]
   71 |     int i = 1;
      |         ^
stove.cpp: At global scope:
stove.cpp:77:1: error: '\U000000a0' does not name a type
   77 |  
      | ^
stove.cpp: In function 'void files()':
stove.cpp:31:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
stove.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~