Submission #723376

#TimeUsernameProblemLanguageResultExecution timeMemory
723376aboutonMeasures (CEOI22_measures)C++17
0 / 100
1533 ms316 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int N, M, D; vector<int> pos; signed main() { scanf("%lld%lld%lld", &N, &M, &D); for (int i = 0; i < N; i ++) { int a; scanf("%lld", &a); pos.push_back(a); } for (int x = 0; x < M; x ++) { int a; scanf("%lld", &a); int cur = pos.size()-1; pos.push_back(0); while (cur >= 0 && pos[cur] > a) { pos[cur+1] = pos[cur]; cur --; } cur++; pos[cur]=a; int maxi = 0; for (int i = 0; i < (int)pos.size(); i ++) { for (int j = i+1; j < (int)pos.size(); j ++) { maxi = max(maxi, (j-i)*D - (pos[j]-pos[i])); } } if (maxi%2==1) cout << (maxi-1)/2 << ".5 "; else cout << maxi/2 << ' '; //for( int i = 0; i < pos.size(); i ++) printf("%d ", pos[i]); //printf("\n"); } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%lld%lld%lld", &N, &M, &D);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%lld", &a);
      |         ~~~~~^~~~~~~~~~~~
Main.cpp:20:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         int a; scanf("%lld", &a);
      |                ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...