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_20614138_28954.cpp:5:25: error: stray '#' in program
     using namespace std;#define repf(i,a,b) for(int i=(a);i<=(b);i++) typedef long long ll; const int N = 4e4+10; int a[N], rec[N<<1];int n, m, pos, cnt;ll ans; int main() {    while (~scanf("%d%d", &n, &m)) {        memset(rec, 0, sizeof(rec));        repf (i, 0, n - 1) {            scanf("%d", &a[i]);            if (a[i] == m) {                pos = i;            }        }        cnt = 0;        for (int i = pos; i >= 0; i--) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            rec[N + cnt]++;        }        cnt = 0;        ans = 0;        for (int i = pos; i < n; i++) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            ans += rec[N - cnt];        }        cout << ans << endl;    }    return 0;}
                         ^
0_0_20614138_28954.cpp:5:26: error: 'define' does not name a type
     using namespace std;#define repf(i,a,b) for(int i=(a);i<=(b);i++) typedef long long ll; const int N = 4e4+10; int a[N], rec[N<<1];int n, m, pos, cnt;ll ans; int main() {    while (~scanf("%d%d", &n, &m)) {        memset(rec, 0, sizeof(rec));        repf (i, 0, n - 1) {            scanf("%d", &a[i]);            if (a[i] == m) {                pos = i;            }        }        cnt = 0;        for (int i = pos; i >= 0; i--) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            rec[N + cnt]++;        }        cnt = 0;        ans = 0;        for (int i = pos; i < n; i++) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            ans += rec[N - cnt];        }        cout << ans << endl;    }    return 0;}
                          ^
0_0_20614138_28954.cpp:5:59: error: 'i' does not name a type
     using namespace std;#define repf(i,a,b) for(int i=(a);i<=(b);i++) typedef long long ll; const int N = 4e4+10; int a[N], rec[N<<1];int n, m, pos, cnt;ll ans; int main() {    while (~scanf("%d%d", &n, &m)) {        memset(rec, 0, sizeof(rec));        repf (i, 0, n - 1) {            scanf("%d", &a[i]);            if (a[i] == m) {                pos = i;            }        }        cnt = 0;        for (int i = pos; i >= 0; i--) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            rec[N + cnt]++;        }        cnt = 0;        ans = 0;        for (int i = pos; i < n; i++) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            ans += rec[N - cnt];        }        cout << ans << endl;    }    return 0;}
                                                           ^
0_0_20614138_28954.cpp:5:66: error: 'i' does not name a type
     using namespace std;#define repf(i,a,b) for(int i=(a);i<=(b);i++) typedef long long ll; const int N = 4e4+10; int a[N], rec[N<<1];int n, m, pos, cnt;ll ans; int main() {    while (~scanf("%d%d", &n, &m)) {        memset(rec, 0, sizeof(rec));        repf (i, 0, n - 1) {            scanf("%d", &a[i]);            if (a[i] == m) {                pos = i;            }        }        cnt = 0;        for (int i = pos; i >= 0; i--) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            rec[N + cnt]++;        }        cnt = 0;        ans = 0;        for (int i = pos; i < n; i++) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            ans += rec[N - cnt];        }        cout << ans << endl;    }    return 0;}
                                                                  ^
0_0_20614138_28954.cpp:5:154: error: 'll' does not name a type
     using namespace std;#define repf(i,a,b) for(int i=(a);i<=(b);i++) typedef long long ll; const int N = 4e4+10; int a[N], rec[N<<1];int n, m, pos, cnt;ll ans; int main() {    while (~scanf("%d%d", &n, &m)) {        memset(rec, 0, sizeof(rec));        repf (i, 0, n - 1) {            scanf("%d", &a[i]);            if (a[i] == m) {                pos = i;            }        }        cnt = 0;        for (int i = pos; i >= 0; i--) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            rec[N + cnt]++;        }        cnt = 0;        ans = 0;        for (int i = pos; i < n; i++) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            ans += rec[N - cnt];        }        cout << ans << endl;    }    return 0;}
                                                                                                                                                          ^
0_0_20614138_28954.cpp: In function 'int main()':
0_0_20614138_28954.cpp:5:260: error: 'i' was not declared in this scope
     using namespace std;#define repf(i,a,b) for(int i=(a);i<=(b);i++) typedef long long ll; const int N = 4e4+10; int a[N], rec[N<<1];int n, m, pos, cnt;ll ans; int main() {    while (~scanf("%d%d", &n, &m)) {        memset(rec, 0, sizeof(rec));        repf (i, 0, n - 1) {            scanf("%d", &a[i]);            if (a[i] == m) {                pos = i;            }        }        cnt = 0;        for (int i = pos; i >= 0; i--) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            rec[N + cnt]++;        }        cnt = 0;        ans = 0;        for (int i = pos; i < n; i++) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            ans += rec[N - cnt];        }        cout << ans << endl;    }    return 0;}
                                                                                                                                                                                                                                                                    ^
0_0_20614138_28954.cpp:5:271: error: 'repf' was not declared in this scope
     using namespace std;#define repf(i,a,b) for(int i=(a);i<=(b);i++) typedef long long ll; const int N = 4e4+10; int a[N], rec[N<<1];int n, m, pos, cnt;ll ans; int main() {    while (~scanf("%d%d", &n, &m)) {        memset(rec, 0, sizeof(rec));        repf (i, 0, n - 1) {            scanf("%d", &a[i]);            if (a[i] == m) {                pos = i;            }        }        cnt = 0;        for (int i = pos; i >= 0; i--) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            rec[N + cnt]++;        }        cnt = 0;        ans = 0;        for (int i = pos; i < n; i++) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            ans += rec[N - cnt];        }        cout << ans << endl;    }    return 0;}
                                                                                                                                                                                                                                                                               ^
0_0_20614138_28954.cpp:5:559: error: 'ans' was not declared in this scope
     using namespace std;#define repf(i,a,b) for(int i=(a);i<=(b);i++) typedef long long ll; const int N = 4e4+10; int a[N], rec[N<<1];int n, m, pos, cnt;ll ans; int main() {    while (~scanf("%d%d", &n, &m)) {        memset(rec, 0, sizeof(rec));        repf (i, 0, n - 1) {            scanf("%d", &a[i]);            if (a[i] == m) {                pos = i;            }        }        cnt = 0;        for (int i = pos; i >= 0; i--) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            rec[N + cnt]++;        }        cnt = 0;        ans = 0;        for (int i = pos; i < n; i++) {            if (a[i] > m) cnt++;            if (a[i] < m) cnt--;            ans += rec[N - cnt];        }        cout << ans << endl;    }    return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2025 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.001000(s) query 1, Server time : 2025-02-17 23:20:32, Gzip enabled