QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#284732 | #7942. $K$ Subsequences | ucup-team1055# | WA | 0ms | 3636kb | C++20 | 901b | 2023-12-16 14:47:21 | 2023-12-16 14:47:22 |
Judging History
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)