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_20614691_21481.cpp:14:26: error: stray '#' in program
      using namespace std;#define pr(x) cout << #x << " = " << x << "  "#define prln(x) cout << #x << " = " << x << endlconst int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, m, a[N], b[N], c[N]; void add(int *b, int i, int v) {    for(; i <= n; i += i & -i) b[i] += v;} int sum(int *b, int i) {    int ret = 0;    for(; i; i -= i & -i) ret += b[i];    return ret;} inline int read() {    int c, x;    while(c = getchar(), !isdigit(c));    x = c - '0';    while(c = getchar(), isdigit(c)) x = x * 10 + c - '0';    return x;} int main() {    ios_base::sync_with_stdio(0);    int t; t = read();    while(t--) {        n = read(); m = read();        for(int i = 1; i <= n; ++i) a[i] = read();         memset(b, 0, sizeof b);        memset(c, 0, sizeof c);        long long tmp = 0;        for(int i = m + 1; i <= n; ++i) {            tmp += i - m - 1 - sum(c, a[i]);            add(c, a[i], 1);        }         long long ans = tmp;        for(int i = m + 1; i <= n; ++i) {            tmp -= sum(c, a[i] - 1);            tmp -= sum(b, n) - sum(b, a[i]);            add(c, a[i], -1);             tmp += sum(c, a[i - m] - 1);            tmp += sum(b, n) - sum(b, a[i - m]);            add(b, a[i - m], 1);             ans = min(ans, tmp);        }        printf("%I64d\n", ans);    }    return 0;}
                          ^
0_0_20614691_21481.cpp:14:48: error: stray '#' in program
      using namespace std;#define pr(x) cout << #x << " = " << x << "  "#define prln(x) cout << #x << " = " << x << endlconst int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, m, a[N], b[N], c[N]; void add(int *b, int i, int v) {    for(; i <= n; i += i & -i) b[i] += v;} int sum(int *b, int i) {    int ret = 0;    for(; i; i -= i & -i) ret += b[i];    return ret;} inline int read() {    int c, x;    while(c = getchar(), !isdigit(c));    x = c - '0';    while(c = getchar(), isdigit(c)) x = x * 10 + c - '0';    return x;} int main() {    ios_base::sync_with_stdio(0);    int t; t = read();    while(t--) {        n = read(); m = read();        for(int i = 1; i <= n; ++i) a[i] = read();         memset(b, 0, sizeof b);        memset(c, 0, sizeof c);        long long tmp = 0;        for(int i = m + 1; i <= n; ++i) {            tmp += i - m - 1 - sum(c, a[i]);            add(c, a[i], 1);        }         long long ans = tmp;        for(int i = m + 1; i <= n; ++i) {            tmp -= sum(c, a[i] - 1);            tmp -= sum(b, n) - sum(b, a[i]);            add(c, a[i], -1);             tmp += sum(c, a[i - m] - 1);            tmp += sum(b, n) - sum(b, a[i - m]);            add(b, a[i - m], 1);             ans = min(ans, tmp);        }        printf("%I64d\n", ans);    }    return 0;}
                                                ^
0_0_20614691_21481.cpp:14:72: error: stray '#' in program
      using namespace std;#define pr(x) cout << #x << " = " << x << "  "#define prln(x) cout << #x << " = " << x << endlconst int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, m, a[N], b[N], c[N]; void add(int *b, int i, int v) {    for(; i <= n; i += i & -i) b[i] += v;} int sum(int *b, int i) {    int ret = 0;    for(; i; i -= i & -i) ret += b[i];    return ret;} inline int read() {    int c, x;    while(c = getchar(), !isdigit(c));    x = c - '0';    while(c = getchar(), isdigit(c)) x = x * 10 + c - '0';    return x;} int main() {    ios_base::sync_with_stdio(0);    int t; t = read();    while(t--) {        n = read(); m = read();        for(int i = 1; i <= n; ++i) a[i] = read();         memset(b, 0, sizeof b);        memset(c, 0, sizeof c);        long long tmp = 0;        for(int i = m + 1; i <= n; ++i) {            tmp += i - m - 1 - sum(c, a[i]);            add(c, a[i], 1);        }         long long ans = tmp;        for(int i = m + 1; i <= n; ++i) {            tmp -= sum(c, a[i] - 1);            tmp -= sum(b, n) - sum(b, a[i]);            add(c, a[i], -1);             tmp += sum(c, a[i - m] - 1);            tmp += sum(b, n) - sum(b, a[i - m]);            add(b, a[i - m], 1);             ans = min(ans, tmp);        }        printf("%I64d\n", ans);    }    return 0;}
                                                                        ^
0_0_20614691_21481.cpp:14:96: error: stray '#' in program
      using namespace std;#define pr(x) cout << #x << " = " << x << "  "#define prln(x) cout << #x << " = " << x << endlconst int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, m, a[N], b[N], c[N]; void add(int *b, int i, int v) {    for(; i <= n; i += i & -i) b[i] += v;} int sum(int *b, int i) {    int ret = 0;    for(; i; i -= i & -i) ret += b[i];    return ret;} inline int read() {    int c, x;    while(c = getchar(), !isdigit(c));    x = c - '0';    while(c = getchar(), isdigit(c)) x = x * 10 + c - '0';    return x;} int main() {    ios_base::sync_with_stdio(0);    int t; t = read();    while(t--) {        n = read(); m = read();        for(int i = 1; i <= n; ++i) a[i] = read();         memset(b, 0, sizeof b);        memset(c, 0, sizeof c);        long long tmp = 0;        for(int i = m + 1; i <= n; ++i) {            tmp += i - m - 1 - sum(c, a[i]);            add(c, a[i], 1);        }         long long ans = tmp;        for(int i = m + 1; i <= n; ++i) {            tmp -= sum(c, a[i] - 1);            tmp -= sum(b, n) - sum(b, a[i]);            add(c, a[i], -1);             tmp += sum(c, a[i - m] - 1);            tmp += sum(b, n) - sum(b, a[i - m]);            add(b, a[i - m], 1);             ans = min(ans, tmp);        }        printf("%I64d\n", ans);    }    return 0;}
                                                                                                ^
0_0_20614691_21481.cpp:14:27: error: 'define' does not name a type
      using namespace std;#define pr(x) cout << #x << " = " << x << "  "#define prln(x) cout << #x << " = " << x << endlconst int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, m, a[N], b[N], c[N]; void add(int *b, int i, int v) {    for(; i <= n; i += i & -i) b[i] += v;} int sum(int *b, int i) {    int ret = 0;    for(; i; i -= i & -i) ret += b[i];    return ret;} inline int read() {    int c, x;    while(c = getchar(), !isdigit(c));    x = c - '0';    while(c = getchar(), isdigit(c)) x = x * 10 + c - '0';    return x;} int main() {    ios_base::sync_with_stdio(0);    int t; t = read();    while(t--) {        n = read(); m = read();        for(int i = 1; i <= n; ++i) a[i] = read();         memset(b, 0, sizeof b);        memset(c, 0, sizeof c);        long long tmp = 0;        for(int i = m + 1; i <= n; ++i) {            tmp += i - m - 1 - sum(c, a[i]);            add(c, a[i], 1);        }         long long ans = tmp;        for(int i = m + 1; i <= n; ++i) {            tmp -= sum(c, a[i] - 1);            tmp -= sum(b, n) - sum(b, a[i]);            add(c, a[i], -1);             tmp += sum(c, a[i - m] - 1);            tmp += sum(b, n) - sum(b, a[i - m]);            add(b, a[i - m], 1);             ans = min(ans, tmp);        }        printf("%I64d\n", ans);    }    return 0;}
                           ^
0_0_20614691_21481.cpp:14:189: error: 'N' was not declared in this scope
      using namespace std;#define pr(x) cout << #x << " = " << x << "  "#define prln(x) cout << #x << " = " << x << endlconst int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, m, a[N], b[N], c[N]; void add(int *b, int i, int v) {    for(; i <= n; i += i & -i) b[i] += v;} int sum(int *b, int i) {    int ret = 0;    for(; i; i -= i & -i) ret += b[i];    return ret;} inline int read() {    int c, x;    while(c = getchar(), !isdigit(c));    x = c - '0';    while(c = getchar(), isdigit(c)) x = x * 10 + c - '0';    return x;} int main() {    ios_base::sync_with_stdio(0);    int t; t = read();    while(t--) {        n = read(); m = read();        for(int i = 1; i <= n; ++i) a[i] = read();         memset(b, 0, sizeof b);        memset(c, 0, sizeof c);        long long tmp = 0;        for(int i = m + 1; i <= n; ++i) {            tmp += i - m - 1 - sum(c, a[i]);            add(c, a[i], 1);        }         long long ans = tmp;        for(int i = m + 1; i <= n; ++i) {            tmp -= sum(c, a[i] - 1);            tmp -= sum(b, n) - sum(b, a[i]);            add(c, a[i], -1);             tmp += sum(c, a[i - m] - 1);            tmp += sum(b, n) - sum(b, a[i - m]);            add(b, a[i - m], 1);             ans = min(ans, tmp);        }        printf("%I64d\n", ans);    }    return 0;}
                                                                                                                                                                                             ^
0_0_20614691_21481.cpp:14:195: error: 'N' was not declared in this scope
      using namespace std;#define pr(x) cout << #x << " = " << x << "  "#define prln(x) cout << #x << " = " << x << endlconst int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7; int n, m, a[N], b[N], c[N]; void add(int *b, int i, int v) {    for(; i <= n; i += i & -i) b[i] += v;} int sum(int *b, int i) {    int ret = 0;    for(; i; i -= i & -i) ret += b[i];    return ret;} inline int read() {    int c, x;    while(c = getchar(), !isdigit(c));    x = c - '0';    while(c = getchar(), isdigit(c)) x = x * 10 + c - '0';    return x;} int main() {    ios_base::sync_with_stdio(0);    int t; t = read();    while(t--) {        n = read(); m = read();        for(int i = 1; i <= n; ++i) a[i] = read();         memset(b, 0, sizeof b);        memset(c, 0, sizeof c);        long long tmp = 0;        for(int i = m + 1; i <= n; ++i) {            tmp += i - m - 1 - sum(c, a[i]);            add(c, a[i], 1);        }         long long ans = tmp;        for(int i = m + 1; i <= n; ++i) {            tmp -= sum(c, a[i] - 1);            tmp -= sum(b, n) - sum(b, a[i]);            add(c, a[i], -1);             tmp += sum(c, a[i - m] - 1);            tmp += sum(b, n) - sum(b, a[i - m]);            add(b, a[i - m], 1);             ans = min(ans, tmp);        }        printf("%I64d\n", ans);    }    return 0;}
                                                                                                                                       


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-05-24 12:26:01, Gzip enabled