제출 #775640

#제출 시각아이디문제언어결과실행 시간메모리
775640danikoynov휴가 (IOI14_holiday)C++14
0 / 100
5040 ms5364 KiB
#include"holiday.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; long long int findMaxAttraction(int n, int start, int d, int attraction[]) { ll ans = 0; for (int i = 0; i <= start; i ++) { multiset < ll > st; ll sum = 0; for (int j = i; j < start; j ++) { sum = sum + attraction[j]; st.insert(attraction[j]); } ll last = -1e18; for (int j = start; j < n; j ++) { sum = sum + attraction[j]; st.insert(attraction[j]); int lf = start - i, rf = j - start; int left = d - min(lf, rf) * 2 - max(lf, rf); if (left < 0) break; while(st.size() > left) { sum = sum - *st.begin(); st.erase(st.begin()); } if (sum > ans) ans = sum; if (sum < last) break; last = sum; } } return ans; }

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

holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:28:29: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |             while(st.size() > left)
      |                   ~~~~~~~~~~^~~~~~
holiday.cpp:33:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   33 |             if (sum > ans)
      |             ^~
holiday.cpp:35:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   35 |                 if (sum < last)
      |                 ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...