Submission #633544

#TimeUsernameProblemLanguageResultExecution timeMemory
633544Ahmed57Global Warming (NOI13_gw)C++14
19 / 40
856 ms65536 KiB
#include <bits/stdc++.h> using namespace std; long long n; long long pre[10000005]; vector<long long> v,w; map<long long,long long> sa,cmp; int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); cin>>n; v.push_back(2); for(int i = 0;i<n;i++){ long long x;cin>>x; w.push_back(x); sa[x]++; } long long z = 1; for(auto i:sa){ cmp[i.first] = ++z; } int pre[z*2+5] = {0}; for(int i = 0;i<w.size();i++){ v.push_back(cmp[w[i]]*2); } for(int i = 0;i<v.size()-1;i++){ if(v[i]<v[i+1]){ pre[v[i+1]]--; pre[v[i]]++; } } long long ma = 0 , cur = 0; for(int i = 2;i<=z*2;i++){ cur+=pre[i]; ma = max(ma,cur); } cout<<ma<<"\n"; }

Compilation message (stderr)

gw.cpp: In function 'int main()':
gw.cpp:22:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i = 0;i<w.size();i++){
      |                   ~^~~~~~~~~
gw.cpp:25:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i = 0;i<v.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...