Submission #785389

#TimeUsernameProblemLanguageResultExecution timeMemory
785389kebineGlobal Warming (CEOI18_glo)C++17
25 / 100
2060 ms3608 KiB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int pre, n, x;
vector<int> a, b;
signed main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cin >> n >> x;
  while(n--) {
    int p; cin >> p;
    vector<int> tempaa=a;
    auto it=lower_bound(tempaa.begin(), tempaa.end(), p);
    if(it==tempaa.end()) tempaa.push_back(p);
    else *it=p;
    vector<int> tempba=b;
    it=lower_bound(tempba.begin(), tempba.end(), p);
    if(it==tempba.end()) tempba.push_back(p);
    else *it=p;
    if(tempaa.size()>tempba.size()) a=tempaa;
    else a=tempba; p-=x;
    it=lower_bound(b.begin(), b.end(), p); 
    if(it==b.end()) b.push_back(p);
    else *it=p;
  }
  cout << max(a.size(), b.size()) << '\n';
  return 0;
}

Compilation message (stderr)

glo.cpp: In function 'int main()':
glo.cpp:20:5: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   20 |     else a=tempba; p-=x;
      |     ^~~~
glo.cpp:20:20: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   20 |     else a=tempba; p-=x;
      |                    ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...