Submission #723363

#TimeUsernameProblemLanguageResultExecution timeMemory
723363t_hollMeasures (CEOI22_measures)C++14
0 / 100
1528 ms448 KiB
#include <bits/stdc++.h> using namespace std; #define num long long int N, M; num D; int compute (vector<num> &res) { num ans = 0; for (int i = 0; i < res.size(); i ++) for (int j = i; j < res.size(); j ++) ans = max(ans, D * (j - i) - res[j] + res[i]); return ans; } int main() { cin >> N >> M >> D; vector<num> res; for (int i = 0; i < N; i ++) { num x; cin >> x; res.push_back(x); } for (int i = 0; i < M; i ++) { num x; cin >> x; res.push_back(x); sort(res.begin(), res.end()); num total = compute(res); cout << total / 2; if (total % 2 == 1) cout << ".5"; cout << " "; } cout << endl; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int compute(std::vector<long long int>&)':
Main.cpp:10:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (int i = 0; i < res.size(); i ++)
      |                     ~~^~~~~~~~~~~~
Main.cpp:11:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         for (int j = i; j < res.size(); j ++)
      |                         ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...