Submission #420525

#TimeUsernameProblemLanguageResultExecution timeMemory
420525schseFinancial Report (JOI21_financial)C++17
48 / 100
4037 ms3788 KiB
#include <bits/stdc++.h> #define INF INT32_MAX using namespace std; int main() { vector<int> arr; int N, D; cin >> N >> D; vector<int> biggest(N + 2, INF); vector<int> lastindex(N + 2, -1); arr.resize(N); for (int &i : arr) cin >> i; for (int index = 0; index < N; index++) { int val = arr[index]; biggest[0] = -1; lastindex[0] = index; for (int i = 1; i < lastindex.size(); i++) // nicht mehr aktuelles löschen { if (lastindex[i] < index - D) lastindex[i] = -1, biggest[i] = INF; } for (int e = 0; e < biggest.size(); e++) // ablaufsdatum updaten if (biggest[e] >= val && biggest[e] != INF) lastindex[e] = index; for (int i = 0; i < biggest.size() - 1; i++) // { if (biggest[i] < val && val < biggest[i + 1]) { biggest[i + 1] = val; lastindex[i + 1] = index; } } } int t = biggest.size() - 1; while (biggest[t] == INF) t--; cout << t; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:22:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for (int i = 1; i < lastindex.size(); i++) // nicht mehr aktuelles löschen
      |                         ~~^~~~~~~~~~~~~~~~~~
Main.cpp:29:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for (int e = 0; e < biggest.size(); e++) // ablaufsdatum updaten
      |                         ~~^~~~~~~~~~~~~~~~
Main.cpp:33:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         for (int i = 0; i < biggest.size() - 1; i++) //
      |                         ~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...