제출 #1019744

#제출 시각아이디문제언어결과실행 시간메모리
1019744NValchanovHoliday (IOI14_holiday)C++17
0 / 100
8 ms1624 KiB
#include <bits/stdc++.h>
#include "holiday.h"

using namespace std;

typedef long long ll;

ll start0(int n, int d, int a[])
{
    ll ans = 0;

    set < ll > s; 

    ll sum = 0;

    for(int i = 0; i < n; i++)
    {
        s.insert((ll)(a[i]));
        sum += (ll)(a[i]);

        ll ost = d - i;

        if(ost == 0)
            break;

        if(s.size() > ost)
        {
            auto it = s.begin();

            sum -= (ll)*it;
            
            s.erase(it);
        }

        ans = max(ans, sum);
    }

    return ans;
}

ll slow(int n, int start, int d, int a[])
{
    return -1;
}

long long int findMaxAttraction(int n, int start, int d, int a[]) 
{
    if(start == 0)
        return start0(n, d, a);
    else
        return slow(n, start, d, a);
}

컴파일 시 표준 에러 (stderr) 메시지

holiday.cpp: In function 'll start0(int, int, int*)':
holiday.cpp:26:21: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   26 |         if(s.size() > ost)
      |            ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...