QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#284732#7942. $K$ Subsequencesucup-team1055#WA 0ms3636kbC++20901b2023-12-16 14:47:212023-12-16 14:47:22

Judging History

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

  • [2023-12-16 14:47:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2023-12-16 14:47:21]
  • 提交

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 ans = (sum%k+1);
        if (i != 0) cout << ' ';
        cout << ans;
        int x; cin >> x;
        sum += x;
        chmax(sum,0);
    }
    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: 3636kb

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:

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

result:

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