답안 #1113159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113159 2024-11-16T01:08:40 Z Tyx2019 Stove (JOI18_stove) C++17
100 / 100
40 ms 3312 KB
#include <bits/stdc++.h>
#define int long long
#define INF 1e18
using namespace std;
int N, T;
int K[200005];
bool work(int tot){
    int sum = 0;
    for(int i=0;i<N;i++){
        sum += tot/K[i];
        if(sum >= T) return true;
    }
    if(sum >= T) return true;
    else return false;
}
void solve(){
    int N, K;
    cin >> N >> K;
    int T[N];
    for(int i=0;i<N;i++) cin >> T[i];
    int ans = N;
    vector<int> V;
    for(int i=1;i<N;i++) V.push_back(T[i] - T[i-1] - 1);
    sort(V.begin(), V.end());
    for(int i=0;i<N-K;i++){
        ans += V[i];
    }
    cout << ans;
}
main(){
    int T=1;
    while(T--) solve();
}

Compilation message

stove.cpp:30:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   30 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 3 ms 336 KB Output is correct
11 Correct 2 ms 336 KB Output is correct
12 Correct 2 ms 500 KB Output is correct
13 Correct 2 ms 336 KB Output is correct
14 Correct 2 ms 336 KB Output is correct
15 Correct 2 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 3 ms 336 KB Output is correct
11 Correct 2 ms 336 KB Output is correct
12 Correct 2 ms 500 KB Output is correct
13 Correct 2 ms 336 KB Output is correct
14 Correct 2 ms 336 KB Output is correct
15 Correct 2 ms 336 KB Output is correct
16 Correct 32 ms 3272 KB Output is correct
17 Correct 40 ms 3312 KB Output is correct
18 Correct 37 ms 3268 KB Output is correct
19 Correct 34 ms 3100 KB Output is correct
20 Correct 33 ms 3264 KB Output is correct
21 Correct 31 ms 3272 KB Output is correct
22 Correct 31 ms 3272 KB Output is correct
23 Correct 31 ms 3288 KB Output is correct
24 Correct 40 ms 3264 KB Output is correct