| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 926552 | parlimoos | Coins (BOI06_coins) | C++14 | 61 ms | 3016 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Be Name KHODA
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define pp pop_back
#define lb lower_bound
#define ub upper_bound
#define cl clear
#define bg begin
#define arr(x) array<int , x>
#define endl '\n'
int n , k;
vector<int> a;
bool has[500000];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0 ; i < n ; i++){
        int d;
        cin >> d >> has[i];
        a.pb(d);
    }
    int o = 0 , cnt = 0;
    for(int i = 0 ; i < n ; i++){
        if(has[i]) continue;
        if(i < n - 1){
            if(o + a[i] < a[i + 1]) o += a[i] , cnt++;
        }else{
            if(o + a[i] < k) o += a[i] , cnt++;
        }
    }
    cout << cnt << endl << min(k - 1 , k - o);
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
