F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_20613904_24179.cpp:11:7: error: 'iterator' in namespace '::' does not name a type
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);        for(int i = 0; i < n; i++) a[i] = -a[i];        gao(dp2, num2);        int ans = 0;        for(int i = 0; i < n; i++)            ans = max(ans, dp1[i] + dp2[i] - min(num1[i], num2[i]));        printf("%d\n", ans);    }    return 0;}
       ^
0_0_20613904_24179.cpp:11:28: error: 'vector' does not name a type
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);        for(int i = 0; i < n; i++) a[i] = -a[i];        gao(dp2, num2);        int ans = 0;        for(int i = 0; i < n; i++)            ans = max(ans, dp1[i] + dp2[i] - min(num1[i], num2[i]));        printf("%d\n", ans);    }    return 0;}
                            ^
0_0_20613904_24179.cpp:11:47: error: 'MAXN' was not declared in this scope
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);        for(int i = 0; i < n; i++) a[i] = -a[i];        gao(dp2, num2);        int ans = 0;        for(int i = 0; i < n; i++)            ans = max(ans, dp1[i] + dp2[i] - min(num1[i], num2[i]));        printf("%d\n", ans);    }    return 0;}
                                               ^
0_0_20613904_24179.cpp:11:61: error: 'MAXN' was not declared in this scope
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);        for(int i = 0; i < n; i++) a[i] = -a[i];        gao(dp2, num2);        int ans = 0;        for(int i = 0; i < n; i++)            ans = max(ans, dp1[i] + dp2[i] - min(num1[i], num2[i]));        printf("%d\n", ans);    }    return 0;}
                                                             ^
0_0_20613904_24179.cpp:11:72: error: 'MAXN' was not declared in this scope
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);        for(int i = 0; i < n; i++) a[i] = -a[i];        gao(dp2, num2);        int ans = 0;        for(int i = 0; i < n; i++)            ans = max(ans, dp1[i] + dp2[i] - min(num1[i], num2[i]));        printf("%d\n", ans);    }    return 0;}
                                                                        ^
0_0_20613904_24179.cpp:11:84: error: 'MAXN' was not declared in this scope
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);        for(int i = 0; i < n; i++) a[i] = -a[i];        gao(dp2, num2);        int ans = 0;        for(int i = 0; i < n; i++)            ans = max(ans, dp1[i] + dp2[i] - min(num1[i], num2[i]));        printf("%d\n", ans);    }    return 0;}
                                                                                    ^
0_0_20613904_24179.cpp:11:96: error: 'MAXN' was not declared in this scope
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);        for(int i = 0; i < n; i++) a[i] = -a[i];        gao(dp2, num2);        int ans = 0;        for(int i = 0; i < n; i++)            ans = max(ans, dp1[i] + dp2[i] - min(num1[i], num2[i]));        printf("%d\n", ans);    }    return 0;}
                                                                                                ^
0_0_20613904_24179.cpp: In function 'void gao(int*, int*)':
0_0_20613904_24179.cpp:11:136: error: 'g' was not declared in this scope
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);        for(int i = 0; i < n; i++) a[i] = -a[i];        gao(dp2, num2);        int ans = 0;        for(int i = 0; i < n; i++)            ans = max(ans, dp1[i] + dp2[i] - min(num1[i], num2[i]));        printf("%d\n", ans);    }    return 0;}
                                                                                                                                        ^
0_0_20613904_24179.cpp:11:150: error: 'Viter' was not declared in this scope
     ::iterator Viter;int n;vector<int>g;int a[MAXN];int dp1[MAXN], dp2[MAXN], num1[MAXN], num2[MAXN];void gao(int dp[], int num[]){    g.clear();    Viter it;    for(int i = n - 1; i >= 0; i--)    {        int sz = g.size();        if(!sz || a[i] >= g[sz - 1])        {            g.push_back(a[i]);            dp[i] = sz + 1;        }        else        {            it = upper_bound(g.begin(), g.end(), a[i]);            dp[i] = it - g.begin() + 1;            *it = a[i];        }        pair<Viter, Viter>bounds = equal_range(g.begin(), g.end(), a[i]);        num[i] = bounds.second - bounds.first;    }}int main(){    int T;    scanf("%d", &T);    while(T--)    {        scanf("%d", &n);        for(int i = 0; i < n; i++) scanf("%d", &a[i]);        gao(dp1, num1);


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-23 04:09:25, Gzip enabled