제출 #584821

#제출 시각아이디문제언어결과실행 시간메모리
584821jack715휴가 (IOI14_holiday)C++14
0 / 100
17 ms1196 KiB
#include"holiday.h" #include <bits/stdc++.h> #define ll long long #define pb push_back #define pp pop_back #define mp make_pair #define bb back #define ff first #define ss second using namespace std; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0, D = d; vector<int> cnt(101, 0); for (int i = 0; i < d; i++) { cnt[attraction[i]]++; ll now = 0, c = d-i; for (int j = 100; j > 0; j--) { if (cnt[j] <= c) now += j*cnt[j], c-=cnt[j]; else now += j*c, c = 0; } ans = max(ans, now); } return ans; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:14:17: warning: unused variable 'D' [-Wunused-variable]
   14 |     ll ans = 0, D = d;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...