Submission #1055379

#TimeUsernameProblemLanguageResultExecution timeMemory
1055379PotatoTheWarriorFRTTFinancial Report (JOI21_financial)C++17
0 / 100
4077 ms2652 KiB
#include <bits/stdc++.h> using namespace std; long long MOD = 998244353; typedef long long ll; int log2(int x) { int ln = -1; while(x > 0) { ln++; x/=2; } return ln; } void solve() { int n, d; cin >> n >> d; ll a[n+1]; vector<ll> vals; int ep = 1; for(int i=0;i<n;i++) { cin >> a[i]; } int ans = 0; vals.push_back(a[n-1]); for(int i=n-2;i>=0;i--) { if(a[i] >= vals[0]) { vals[0] = a[i]; ep = 1; }else if(a[i] < vals[ep-1]) { if(ep == vals.size()) { vals.push_back(a[i]); }else{ vals[ep] = a[i]; } ep++; }else{ int r = 0; int l = ep-1; while(l-r > 0) { int m = (l+r)/2; if(a[i] < vals[m]) { l = m; }else if(a[i] >= vals[m]) { r = m-1; } } vals[l+1] = a[i]; } // cout << ep << endl; ans = max(ans, ep); } cout << ans << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; // cin >> t; // while (t--) solve(); char sdhfn; }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:30:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if(ep == vals.size()) {
      |                ~~~^~~~~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:59:9: warning: unused variable 't' [-Wunused-variable]
   59 |     int t;
      |         ^
Main.cpp:63:10: warning: unused variable 'sdhfn' [-Wunused-variable]
   63 |     char sdhfn;
      |          ^~~~~
#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...