제출 #633578

#제출 시각아이디문제언어결과실행 시간메모리
633578Ahmed57지구 온난화 (NOI13_gw)C++14
19 / 40
1096 ms65536 KiB
#include <bits/stdc++.h> using namespace std; long long n; long long pre[2000005]; vector<long long> w,s; map<long long,long long> cmp; int main(){ cin>>n; int la = 2; for(int i = 0;i<n;i++){ long long x;cin>>x; w.push_back(x); s.push_back(x); } sort(s.begin(),s.end()); long long z = 1; for(int i = 0;i<n;i++){ if(i&&s[i]==s[i-1])z--; cmp[s[i]] = ++z; } for(int i = 0;i<w.size();i++){ if(la<cmp[w[i]]*2){ pre[la]++; pre[cmp[w[i]]*2]--; } la = cmp[w[i]]*2; } long long ma = 0 , cur = 0; for(int i = 2;i<=z*2;i++){ cur+=pre[i]; ma = max(ma,cur); } cout<<ma<<"\n"; }

컴파일 시 표준 에러 (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++){
      |                   ~^~~~~~~~~
#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...