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_20613260_32645.cpp:4:25: error: stray '#' in program
     using namespace std;#define typev int #define N 200000typev ar[N]; int lowb(int t) { return t & (-t) ; }void add(int i, typev v){for ( ; i < N; ar[i] += v, i += lowb(i));}typev sum(int i){    typev s = 0;    for ( ; i > 0; s += ar[i], i -= lowb(i));    return s;}int n, m, k;long long nowans;int x[N], L[N], R[N], sta[N];void init(){    memset(L, -1, sizeof(L)); memset(R, -1, sizeof(R));    memset(ar, 0, sizeof(ar));    for(int i = 1; i <= n; i++) if (x[i] < k)        for(int j = i + 1; j <= n && x[j] >= k; j++)            L[j] = i;    for(int i = n; i >= 1; i--) if (x[i] < k)        for(int j = i - 1; j >= 1 && x[j] >= k; j--)            R[j] = i;}int Get(int l, int r, int now){    if (l > r) return 0;    if (l == -1 || r == -1) return 0;    if (now == 0) return r - l + 1 - (sum(r) - sum(l - 1));    return sum(r) - sum(l - 1);}int main(){    int t;scanf("%d", &t);    while(t--)    {        scanf("%d%d%d", &n, &m, &k);        for(int i = 1; i <= n; i++) scanf("%d", &x[i]);        init();        for(int i = 1; i <= n; i++)        {            scanf("%d", &sta[i]);            if (sta[i]) add(i, 1);        }        nowans = 0;        for(int i = 1; i <= n; i++)            if (x[i] < k) nowans += Get(i + 1, n, !sta[i]);            else nowans += Get(R[i], n, !sta[i]);        while(m--)        {            int tmp;scanf("%d", &tmp);            if (tmp == 1) cout << nowans << endl;            else            {                scanf("%d", &tmp);                int before = 0, after = 0;                int i = tmp;                if (x[tmp] < k)                {                    before += Get(1, i - 1, !sta[i]) + Get(i + 1, n, !sta[i]);                    after += Get(1, i - 1, sta[i]) + Get(i + 1, n, sta[i]);                }else                {                    before += Get(1, L[i], !sta[i]) + Get(R[i], n, !sta[i]);                    after += Get(1, L[i], sta[i]) + Get(R[i], n, sta[i]);                }                if (sta[i] == 0) add(i, 1), sta[i] = 1;                else add(i, -1), sta[i] = 0;                nowans += (after - before);            }         }    }    return 0;}
                         ^
0_0_20613260_32645.cpp:4:43: error: stray '#' in program
     using namespace std;#define typev int #define N 200000typev ar[N]; int lowb(int t) { return t & (-t) ; }void add(int i, typev v){for ( ; i < N; ar[i] += v, i += lowb(i));}typev sum(int i){    typev s = 0;    for ( ; i > 0; s += ar[i], i -= lowb(i));    return s;}int n, m, k;long long nowans;int x[N], L[N], R[N], sta[N];void init(){    memset(L, -1, sizeof(L)); memset(R, -1, sizeof(R));    memset(ar, 0, sizeof(ar));    for(int i = 1; i <= n; i++) if (x[i] < k)        for(int j = i + 1; j <= n && x[j] >= k; j++)            L[j] = i;    for(int i = n; i >= 1; i--) if (x[i] < k)        for(int j = i - 1; j >= 1 && x[j] >= k; j--)            R[j] = i;}int Get(int l, int r, int now){    if (l > r) return 0;    if (l == -1 || r == -1) return 0;    if (now == 0) return r - l + 1 - (sum(r) - sum(l - 1));    return sum(r) - sum(l - 1);}int main(){    int t;scanf("%d", &t);    while(t--)    {        scanf("%d%d%d", &n, &m, &k);        for(int i = 1; i <= n; i++) scanf("%d", &x[i]);        init();        for(int i = 1; i <= n; i++)        {            scanf("%d", &sta[i]);            if (sta[i]) add(i, 1);        }        nowans = 0;        for(int i = 1; i <= n; i++)            if (x[i] < k) nowans += Get(i + 1, n, !sta[i]);            else nowans += Get(R[i], n, !sta[i]);        while(m--)        {            int tmp;scanf("%d", &tmp);            if (tmp == 1) cout << nowans << endl;            else            {                scanf("%d", &tmp);                int before = 0, after = 0;                int i = tmp;                if (x[tmp] < k)                {                    before += Get(1, i - 1, !sta[i]) + Get(i + 1, n, !sta[i]);                    after += Get(1, i - 1, sta[i]) + Get(i + 1, n, sta[i]);                }else                {                    before += Get(1, L[i], !sta[i]) + Get(R[i], n, !sta[i]);                    after += Get(1, L[i], sta[i]) + Get(R[i], n, sta[i]);                }                if (sta[i] == 0) add(i, 1), sta[i] = 1;                else add(i, -1), sta[i] = 0;                nowans += (after - before);            }         }    }    return 0;}
                                           ^
0_0_20613260_32645.cpp:4:26: error: 'define' does not name a type
     using namespace std;#define typev int #define N 200000typev ar[N]; int lowb(int t) { return t & (-t) ; }void add(int i, typev v){for ( ; i < N; ar[i] += v, i += lowb(i));}typev sum(int i){    typev s = 0;    for ( ; i > 0; s += ar[i], i -= lowb(i));    return s;}int n, m, k;long long nowans;int x[N], L[N], R[N], sta[N];void init(){    memset(L, -1, sizeof(L)); memset(R, -1, sizeof(R));    memset(ar, 0, sizeof(ar));    for(int i = 1; i <= n; i++) if (x[i] < k)        for(int j = i + 1; j <= n && x[j] >= k; j++)            L[j] = i;    for(int i = n; i >= 1; i--) if (x[i] < k)        for(int j = i - 1; j >= 1 && x[j] >= k; j--)            R[j] = i;}int Get(int l, int r, int now){    if (l > r) return 0;    if (l == -1 || r == -1) return 0;    if (now == 0) return r - l + 1 - (sum(r) - sum(l - 1));    return sum(r) - sum(l - 1);}int main(){    int t;scanf("%d", &t);    while(t--)    {        scanf("%d%d%d", &n, &m, &k);        for(int i = 1; i <= n; i++) scanf("%d", &x[i]);        init();        for(int i = 1; i <= n; i++)        {            scanf("%d", &sta[i]);            if (sta[i]) add(i, 1);        }        nowans = 0;        for(int i = 1; i <= n; i++)            if (x[i] < k) nowans += Get(i + 1, n, !sta[i]);            else nowans += Get(R[i], n, !sta[i]);        while(m--)        {            int tmp;scanf("%d", &tmp);            if (tmp == 1) cout << nowans << endl;            else            {                scanf("%d", &tmp);                int before = 0, after = 0;                int i = tmp;                if (x[tmp] < k)                {                    before += Get(1, i - 1, !sta[i]) + Get(i + 1, n, !sta[i]);                    after += Get(1, i - 1, sta[i]) + Get(i + 1, n, sta[i]);                }else                {                    before += Get(1, L[i], !sta[i]) + Get(R[i], n, !sta[i]);                    after += Get(1, L[i], sta[i]) + Get(R[i], n, sta[i]);                }                if (sta[i] == 0) add(i, 1), sta[i] = 1;                else add(i, -1), sta[i] = 0;                nowans += (after - before);            }         }    }    return 0;}
                          ^
0_0_20613260_32645.cpp:4:125: error: 'typev' has not been declared
     using namespace std;#define typev int #define N 200000typev ar[N]; int lowb(int t) { return t & (-t) ; }void add(int i, typev v){for ( ; i < N; ar[i] += v, i += lowb(i));}typev sum(int i){    typev s = 0;    for ( ; i > 0; s += ar[i], i -= lowb(i));    return s;}int n, m, k;long long nowans;int x[N], L[N], R[N], sta[N];void init(){    memset(L, -1, sizeof(L)); memset(R, -1, sizeof(R));    memset(ar, 0, sizeof(ar));    for(int i = 1; i <= n; i++) if (x[i] < k)        for(int j = i + 1; j <= n && x[j] >= k; j++)            L[j] = i;    for(int i = n; i >= 1; i--) if (x[i] < k)        for(int j = i - 1; j >= 1 && x[j] >= k; j--)            R[j] = i;}int Get(int l, int r, int now){    if (l > r) return 0;    if (l == -1 || r == -1) return 0;    if (now == 0) return r - l + 1 - (sum(r) - sum(l - 1));    return sum(r) - sum(l - 1);}int main(){    int t;scanf("%d", &t);    while(t--)    {        scanf("%d%d%d", &n, &m, &k);        for(int i = 1; i <= n; i++) scanf("%d", &x[i]);        init();        for(int i = 1; i <= n; i++)        {            scanf("%d", &sta[i]);            if (sta[i]) add(i, 1);        }        nowans = 0;        for(int i = 1; i <= n; i++)            if (x[i] < k) nowans += Get(i + 1, n, !sta[i]);            else nowans += Get(R[i], n, !sta[i]);        while(m--)        {            int tmp;scanf("%d", &tmp);            if (tmp == 1) cout << nowans << endl;            else            {                scanf("%d", &tmp);                int before = 0, after = 0;                int i = tmp;                if (x[tmp] < k)                {                    before += Get(1, i - 1, !sta[i]) + Get(i + 1, n, !sta[i]);                    after += Get(1, i - 1, sta[i]) + Get(i + 1, n, sta[i]);                }else                {                    before += Get(1, L[i], !sta[i]) + Get(R[i], n, !sta[i]);                    after += Get(1, L[i], sta[i]) + Get(R[i], n, sta[i]);                }                if (sta[i] == 0) add(i, 1), sta[i] = 1;                else add(i, -1), sta[i] = 0;                nowans += (after - before);            }         }    }    return 0;}
                                                                                                                             ^
0_0_20613260_32645.cpp: In function 'void add(int, int)':
0_0_20613260_32645.cpp:4:146: error: 'N' was not declared in this scope
     using namespace std;#define typev int #define N 200000typev ar[N]; int lowb(int t) { return t & (-t) ; }void add(int i, typev v){for ( ; i < N; ar[i] += v, i += lowb(i));}typev sum(int i){    typev s = 0;    for ( ; i > 0; s += ar[i], i -= lowb(i));    return s;}int n, m, k;long long nowans;int x[N], L[N], R[N], sta[N];void init(){    memset(L, -1, sizeof(L)); memset(R, -1, sizeof(R));    memset(ar, 0, sizeof(ar));    for(int i = 1; i <= n; i++) if (x[i] < k)        for(int j = i + 1; j <= n && x[j] >= k; j++)            L[j] = i;    for(int i = n; i >= 1; i--) if (x[i] < k)        for(int j = i - 1; j >= 1 && x[j] >= k; j--)            R[j] = i;}int Get(int l, int r, int now){    if (l > r) return 0;    if (l == -1 || r == -1) return 0;    if (now == 0) return r - l + 1 - (sum(r) - sum(l - 1));    return sum(r) - sum(l - 1);}int main(){    int t;scanf("%d", &t);    while(t--)    {        scanf("%d%d%d", &n, &m, &k);        for(int i = 1; i <= n; i++) scanf("%d", &x[i]);        init();        for(int i = 1; i <= n; i++)        {            scanf("%d", &sta[


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-26 04:39:55, Gzip enabled