답안 #633533

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
633533 2022-08-22T17:03:20 Z Ahmed57 지구 온난화 (NOI13_gw) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
long long n;
int pre[3000001];
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n;
    vector<long long> v,w;
    v.push_back(2);
    map<long long,long long> sa.cmp;
    for(int i = 0;i<n;i++){
        long long x;cin>>x;
        w.push_back(x);
        sa[x]++;
    }
    long long z = 2;
    for(auto i:sa){
        cmp[i.first] = z++;
    }
    for(int i = 0;i<n;i++){
        v.push_back(cmp[w[i]]*2);
    }
    for(int i = 0;i<n;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<(n+2)*2;i++){
        cur+=pre[i];
        ma = max(ma,cur);
    }
    cout<<ma<<"\n";
}

Compilation message

gw.cpp: In function 'int main()':
gw.cpp:11:32: error: expected initializer before '.' token
   11 |     map<long long,long long> sa.cmp;
      |                                ^
gw.cpp:15:9: error: 'sa' was not declared in this scope
   15 |         sa[x]++;
      |         ^~
gw.cpp:18:16: error: 'sa' was not declared in this scope
   18 |     for(auto i:sa){
      |                ^~
gw.cpp:19:9: error: 'cmp' was not declared in this scope; did you mean 'bcmp'?
   19 |         cmp[i.first] = z++;
      |         ^~~
      |         bcmp
gw.cpp:22:21: error: 'cmp' was not declared in this scope; did you mean 'bcmp'?
   22 |         v.push_back(cmp[w[i]]*2);
      |                     ^~~
      |                     bcmp