QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#284727#7942. $K$ Subsequencesucup-team1055#WA 0ms3568kbC++20901b2023-12-16 14:45:402023-12-16 14:45:41

Judging History

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

  • [2023-12-16 14:45:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3568kb
  • [2023-12-16 14:45:40]
  • 提交

answer

#include <bits/stdc++.h>

using ll = long long;
using ull = unsigned long long;

#define rep(i,s,n) for(int i = int(s); i < int(n); i++)
#define rrep(i,s,n) for(int i = int(n) - 1; i >= int(s); i--)
#define all(v) (v).begin(), (v).end()

template<class T>
bool chmin(T &a, T b) {
    if(a <= b) return false;
    a = b;
    return true;
}

template<class T>
bool chmax(T &a, T b) {
    if(a >= b) return false;
    a = b;
    return true;
}

using namespace std;

void solve(){
    int n, k; cin >> n >> k;
    int sum = 0;
    rep(i,0,n){
        int x; cin >> x;
        sum += x;
        chmax(sum,0);
        int ans = (sum%k+1);
        if (i != 0) cout << ' ';
        cout << ans;
    }
    cout << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int t; cin >> t;
    while (t--){
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
3 2
1 -1 1
4 2
-1 1 1 -1
7 3
1 1 1 1 1 1 1
10 3
1 1 1 1 -1 -1 1 1 1 1
12 4
1 1 1 1 -1 -1 -1 -1 1 1 1 1

output:

2 1 2
1 2 1 2
2 3 1 2 3 1 2
2 3 1 2 1 3 1 2 3 1
2 3 4 1 4 3 2 1 2 3 4 1

result:

wrong answer Jury found better answer than participant (test case 1)