Submission #252214

#TimeUsernameProblemLanguageResultExecution timeMemory
252214ekremStove (JOI18_stove)C++98
0 / 100
0 ms256 KiB
#include <cstdio> #include <vector> #include <algorithm> using namespace std; const int INF = 999999999; int main() { int N, M; scanf("%d%d", &N, &M); vector<int> a(++N, 0); for (int i = 1; i < N; i++) scanf("%d", &a[i]); vector<int> b(1, INF); for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) b.push_back(-(a[i]+a[j])); sort(b.begin(), b.end()); int ans = 0; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) ans = max(ans, a[i]+a[j] + -*lower_bound(b.begin(), b.end(), -(M - (a[i]+a[j])))); printf("%d\n", ans); return 0; }

Compilation message (stderr)

stove.cpp: In function 'int main()':
stove.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &N, &M);
   ~~~~~^~~~~~~~~~~~~~~~
stove.cpp:12:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (int i = 1; i < N; i++) scanf("%d", &a[i]);
                               ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...