Submission #285555

#TimeUsernameProblemLanguageResultExecution timeMemory
2855552qbingxuanHoliday (IOI14_holiday)C++14
Compilation error
0 ms0 KiB
#include"holiday.h"

long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
    if(start == 0) {
        int cnt[101] = {};
        for(int i = 0; i < n; i++) {
            ++cnt[attraction[i]];
            if(d - i - 1 > 0) {
                int k = d - i - 1;
                int ans = 0;
                for(int j = 100; j >= 1; j--) {
                    if(k > cnt[j]) k -= cnt[j], ans += cnt[j] * j;
                    else ans += cnt[j] * k, k = 0;
                }
                cout << ans << '\n';
            }
        }
    }
}

Compilation message (stderr)

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:15:17: error: 'cout' was not declared in this scope
   15 |                 cout << ans << '\n';
      |                 ^~~~
holiday.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^