QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#706468#5435. Clamped Sequencehejinming983282#WA 0ms3528kbC++141.0kb2024-11-03 11:33:332024-11-03 11:33:34

Judging History

你现在查看的是最新测评结果

  • [2024-11-03 11:33:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3528kb
  • [2024-11-03 11:33:33]
  • 提交

answer

// Author : hejinming2012
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define dbg(x) cout << #x " = " << (x) << endl
#define quickio ios::sync_with_stdio(false);
#define quickin cin.tie(0);
#define quickout cout.tie(0);

using namespace std;
inline int read() {
    int now = 0, nev = 1; char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') nev = -1; c = getchar(); }
    while(c >= '0' && c <= '9') { now = (now << 1) + (now << 3) + (c & 15); c = getchar(); }
    return now * nev;
}
void write(int x) {
    if(x < 0) putchar('-'), x = -x;
    if(x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

signed main() {
    quickio
    quickin
    quickout
    int n, d; cin >> n >> d;
    vector <int> a(n + 1);
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        int now = 0;
        for(int j = i + 1; j <= min(n, i + d + 1); j++)
            now += abs(a[j] - a[j - 1]), ans = max(ans, now);
    }
    write(ans), putchar(10);
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3528kb

input:

8 3
3 1 4 1 5 9 2 6

output:

19

result:

wrong answer 1st numbers differ - expected: '15', found: '19'