QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#285795 | #7942. $K$ Subsequences | ucup-team1951# | AC ✓ | 31ms | 16012kb | C++17 | 5.3kb | 2023-12-16 22:56:11 | 2023-12-16 22:56:11 |
Judging History
answer
// g++-13 1.cpp -std=c++17 -O2 -I .
#include <bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;
#include <algorithm>
#include <cassert>
#include <vector>
#ifdef _MSC_VER
#include <intrin.h>
#endif
namespace atcoder {
namespace internal {
int ceil_pow2(int n) {
int x = 0;
while ((1U << x) < (unsigned int)(n)) x++;
return x;
}
int bsf(unsigned int n) {
#ifdef _MSC_VER
unsigned long index;
_BitScanForward(&index, n);
return index;
#else
return __builtin_ctz(n);
#endif
}
} // namespace internal
} // namespace atcoder
namespace atcoder {
template <class S, S (*op)(S, S), S (*e)()> struct segtree {
public:
segtree() : segtree(0) {}
explicit segtree(int n) : segtree(std::vector<S>(n, e())) {}
explicit segtree(const std::vector<S>& v) : _n(int(v.size())) {
log = internal::ceil_pow2(_n);
size = 1 << log;
d = std::vector<S>(2 * size, e());
for (int i = 0; i < _n; i++) d[size + i] = v[i];
for (int i = size - 1; i >= 1; i--) {
update(i);
}
}
void set(int p, S x) {
assert(0 <= p && p < _n);
p += size;
d[p] = x;
for (int i = 1; i <= log; i++) update(p >> i);
}
S get(int p) const {
assert(0 <= p && p < _n);
return d[p + size];
}
S prod(int l, int r) const {
assert(0 <= l && l <= r && r <= _n);
S sml = e(), smr = e();
l += size;
r += size;
while (l < r) {
if (l & 1) sml = op(sml, d[l++]);
if (r & 1) smr = op(d[--r], smr);
l >>= 1;
r >>= 1;
}
return op(sml, smr);
}
S all_prod() const { return d[1]; }
template <bool (*f)(S)> int max_right(int l) const {
return max_right(l, [](S x) { return f(x); });
}
template <class F> int max_right(int l, F f) const {
assert(0 <= l && l <= _n);
assert(f(e()));
if (l == _n) return _n;
l += size;
S sm = e();
do {
while (l % 2 == 0) l >>= 1;
if (!f(op(sm, d[l]))) {
while (l < size) {
l = (2 * l);
if (f(op(sm, d[l]))) {
sm = op(sm, d[l]);
l++;
}
}
return l - size;
}
sm = op(sm, d[l]);
l++;
} while ((l & -l) != l);
return _n;
}
template <bool (*f)(S)> int min_left(int r) const {
return min_left(r, [](S x) { return f(x); });
}
template <class F> int min_left(int r, F f) const {
assert(0 <= r && r <= _n);
assert(f(e()));
if (r == 0) return 0;
r += size;
S sm = e();
do {
r--;
while (r > 1 && (r % 2)) r >>= 1;
if (!f(op(d[r], sm))) {
while (r < size) {
r = (2 * r + 1);
if (f(op(d[r], sm))) {
sm = op(d[r], sm);
r--;
}
}
return r + 1 - size;
}
sm = op(d[r], sm);
} while ((r & -r) != r);
return 0;
}
private:
int _n, size, log;
std::vector<S> d;
void update(int k) { d[k] = op(d[2 * k], d[2 * k + 1]); }
};
} // namespace atcoder
using namespace atcoder;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())
// 今の総和 - prefix_sum の min
// -1 が来たら一番右が大きいのをひく
// +1 が来たら一番右が小さいのに足す
using T = tuple<int,int,int,int>;
T op(T a,T b){
auto [mx_v1,mx_i1,mn_v1,mn_i1]=a;
auto [mx_v2,mx_i2,mn_v2,mn_i2]=b;
if(mx_v1<mx_v2){
swap(mx_v1,mx_v2);
swap(mx_i1,mx_i2);
}
if(mn_v1>mn_v2){
swap(mn_v1,mn_v2);
swap(mn_i1,mn_i2);
}
return {mx_v1,mx_i1,mn_v1,mn_i1};
}
T e(){
return {-1e9,-1,1e9,-1};
}
void solve(){
int n,k;cin>>n>>k;
vector<T> init;
rep(i,0,k){
init.emplace_back(0,i,0,i);
}
vi sum(k,0),mn(k,0);
segtree<T,op,e> seg(init);
rep(i,0,n){
int a;cin>>a;
auto [mx_v,mx_i,mn_v,mn_i]=seg.all_prod();
// cout<<" ! "<<mx_v<<" "<<mx_i<<" "<<mn_v<<" "<<mn_i<<endl;
if(a==1){
cout<<mn_i+1<<" ";
sum[mn_i]++;
seg.set(mn_i,{sum[mn_i]-mn[mn_i],mn_i,sum[mn_i]-mn[mn_i],mn_i});
}
else{
cout<<mx_i+1<<" ";
sum[mx_i]--;
mn[mx_i]=min(mn[mx_i],sum[mx_i]);
seg.set(mx_i,{sum[mx_i]-mn[mx_i],mx_i,sum[mx_i]-mn[mx_i],mx_i});
}
}
cout<<endl;
}
/*
1 1 -1 -1 1 1
1 1
1 1
*/
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
while(t--){
solve();
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3548kb
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 1 1 1 1 2 1 1 2 3 1 2 3 1 1 2 3 1 1 1 1 1 2 3 1 2 3 4 1 2 3 4 1 2 3 4
result:
ok Correct (5 test cases)
Test #2:
score: 0
Accepted
time: 23ms
memory: 3596kb
input:
18434 10 1 -1 1 1 -1 -1 1 -1 -1 1 1 10 2 -1 -1 -1 1 1 -1 1 1 1 1 10 2 1 -1 -1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2 3 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 2 3 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 2 3 1 2 3 1 2 3 1 1 1 2 3 1 2 1 1 1 1 3 1 1 1 2 3 1 1 1 1 1 2 1 2 1 1 1 ...
result:
ok Correct (1 test case)
Test #4:
score: 0
Accepted
time: 18ms
memory: 3628kb
input:
1 199998 152 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 -1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 3 1 2 3 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 3 4 1 1 5 6 1 2 1 1 3 1 2 1 2 4 5 1 1 6 1 1 1 2 1 1 3 1 2 1 1 3 1 1 1 1 1 2 1 1 1 1 3 4 5 1 2 1 2 1 1 6 7 8 9 10 1 2 1 1 3 4 1 2 1 1 1 1 1 2 1 1 1 1 1 1 5...
result:
ok Correct (1 test case)
Test #5:
score: 0
Accepted
time: 22ms
memory: 3616kb
input:
1 199996 136 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 1 -1 -1 1 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 2 3 1 1 4 ...
result:
ok Correct (1 test case)
Test #7:
score: 0
Accepted
time: 28ms
memory: 16012kb
input:
1 199998 196586 1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 2 3 1 1 1 1 1 2 1 1 1 1 1 1 3 4 1 2 3 4 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 1 1 6 1 1 7 8 9 1 2 3 1 2 1 2 1 2 1 2 4 1 1 5 6 1 1 7 8 1 1 9 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 4 1 1 5 1 1 1 2 1 1 ...
result:
ok Correct (1 test case)
Test #8:
score: 0
Accepted
time: 28ms
memory: 9904kb
input:
2 53064 32664 1 1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 1 ...
output:
1 2 3 1 1 4 5 1 1 6 7 1 2 1 1 3 1 2 3 1 2 1 1 1 2 8 1 2 3 1 1 4 5 6 7 1 1 1 1 8 1 1 1 1 2 1 2 1 1 1 2 3 1 1 1 2 3 1 1 2 3 4 1 1 5 1 1 1 1 1 2 1 1 1 1 3 1 1 1 2 1 1 3 1 2 3 1 2 3 6 7 1 1 8 1 1 9 1 2 3 4 1 2 1 2 5 1 1 1 2 1 2 1 2 3 1 2 3 1 1 6 7 1 1 8 1 1 1 2 3 1 2 1 2 4 1 1 5 1 2 1 2 1 1 6 7 1 2 1 2 ...
result:
ok Correct (2 test cases)
Test #9:
score: 0
Accepted
time: 17ms
memory: 3836kb
input:
2 86135 2 1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 1...
output:
1 2 1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 ...
result:
ok Correct (2 test cases)
Test #10:
score: 0
Accepted
time: 25ms
memory: 4808kb
input:
2 114819 248 -1 -1 -1 -1 -1 1 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 1 1 1 1 3 1 2 1 2 4 5 6 7 1 2 1 2 1 1 13 1 2 1 1 1 2 1 2 3 1 1 4 1 1 5 1 1 1 1 1 2 3 4 1 2 1 1 3 1 2 1 1 3 5 14 1 1 1 1...
result:
ok Correct (4 test cases)
Test #15:
score: 0
Accepted
time: 28ms
memory: 6832kb
input:
5 7824 2 -1 -1 -1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1...
output:
1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 2 1 1 1 2 1 2 1 1 1 1 2 1 2 1 2 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...
result:
ok Correct (5 test cases)
Test #16:
score: 0
Accepted
time: 20ms
memory: 3780kb
input:
6 7149 4795 -1 -1 1 -1 -1 1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1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1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok Correct (7 test cases)
Test #18:
score: 0
Accepted
time: 25ms
memory: 4820kb
input:
8 29021 106 -1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 ...
output:
1 1 1 1 1 1 1 1 1 1 1 2 3 1 2 1 2 4 5 6 1 2 1 2 1 2 3 1 2 1 2 4 5 6 1 1 2 1 1 3 4 1 2 3 1 2 3 5 6 7 8 9 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 10 1 1 1 2 3 1 2 3 11 1 2 3 4 1 1 1 1 5 1 2 1 2 6 1 1 1 2 1 1 3 4 1 1 1 1 5 1 2 3 1 1 4 5 1 1 7 1 2 1 1 3 1 1 1 2 3 8 9 1 2 3 1 1 1 1 4 5 1 2 3 4 5 10 11 1 1 1 2 3 ...
result:
ok Correct (8 test cases)
Test #19:
score: 0
Accepted
time: 19ms
memory: 4816kb
input:
9 37136 1 -1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 1 1 1 1 -1 1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 ...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok Correct (9 test cases)
Test #20:
score: 0
Accepted
time: 26ms
memory: 6572kb
input:
10 5543 1596 1 1 1 -1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 -1 -1 1 1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 ...
output:
1 2 3 1 1 4 5 1 2 3 1 2 1 2 4 1 1 1 1 5 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 2 1 2 1 2 3 4 5 1 2 1 2 1 1 6 1 1 1 1 7 1 2 3 1 1 1 1 4 1 1 5 6 1 1 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 1 1 2 1 2 1 1 1 1 1 1 2 3 1 1 4 5 6 1 2 3 4 5 1 1 6 1 1 1 1 1 2 1 2 1 1 2 3 ...
result:
ok Correct (10 test cases)
Test #21:
score: 0
Accepted
time: 20ms
memory: 3908kb
input:
100 2336 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1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 1 4 5 6 1 1 1 2 1 1 3 4 1 1 5 6 1 2 1 2 1 1 1 1 1 1 1 2 1 2 1 1 1 2 3 1 2 1 1 1 1 3 1 2 3 4 5 1 1 6...
result:
ok Correct (101 test cases)
Test #23:
score: 0
Accepted
time: 21ms
memory: 3844kb
input:
102 8381 7064 -1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 -1...
output:
1 1 1 2 1 2 1 1 1 2 3 4 5 1 2 1 1 1 1 1 2 6 1 2 3 1 1 1 2 3 7 1 2 3 4 1 2 3 1 2 1 2 1 1 1 1 1 2 1 1 3 1 1 1 2 1 2 1 2 3 1 2 3 1 2 3 4 8 9 1 2 1 1 1 1 3 4 5 1 2 1 1 3 1 2 1 1 3 1 1 6 7 1 1 8 1 1 1 2 1 2 1 2 3 4 1 2 1 2 5 1 1 1 2 3 1 1 1 1 4 5 1 1 9 1 1 1 2 1 2 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 2 3 ...
result:
ok Correct (102 test cases)
Test #24:
score: 0
Accepted
time: 20ms
memory: 3904kb
input:
103 1976 404 1 -1 -1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -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 1 2 3 1 2 1 2 1 2 3 1 1 1 2 3 1 1 1 1 1 2 1 2 1 1 1 2 3 1 1 1 2 1 2 1 1 1 2 3 1 1 1 2 1 2 1 2 1 2 1 1 1 2 3 1 1 1 ...
result:
ok Correct (104 test cases)
Test #26:
score: 0
Accepted
time: 21ms
memory: 3872kb
input:
105 1344 10 1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1...
output:
1 2 3 1 1 1 1 1 2 3 1 1 1 2 3 4 5 1 1 6 7 1 1 1 1 8 9 10 1 1 1 2 1 2 1 2 3 1 1 4 1 1 5 6 1 1 1 2 1 1 1 1 3 1 1 1 2 3 7 8 9 10 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 1 1 1 4 5 6 1 1 7 8 1 1 1 2 3 1 1 1 2 1 1 1 1 3 9 1 1 1 1 1 2 1 2 1 2 1 2 1 1 1 2 3 4 1 1 5 6 1 2 3 1 1 4 1 2 1 2 1 1 5 6 10 1 2 1 1 3 4 5 1 2...
result:
ok Correct (105 test cases)
Test #27:
score: 0
Accepted
time: 21ms
memory: 3652kb
input:
1000 1284 8 1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 -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1 1 1 2 1 2 1 1 1 1 1 1 1 1 ...
result:
ok Correct (1001 test cases)
Test #29:
score: 0
Accepted
time: 17ms
memory: 3752kb
input:
1002 182 6 1 1 1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1...
output:
1 2 3 4 1 2 1 1 3 1 2 1 1 3 1 1 5 6 1 2 1 2 1 2 1 1 1 2 1 1 1 1 1 2 3 1 1 4 1 2 3 4 1 1 1 2 1 2 1 2 3 1 1 1 1 4 5 1 2 3 1 1 4 5 1 1 1 2 3 4 1 1 1 1 1 2 1 2 1 2 3 4 1 1 1 1 1 2 3 1 2 3 1 2 3 4 1 1 1 2 3 1 1 4 1 2 1 2 1 2 3 4 1 1 1 2 3 4 1 1 1 2 1 1 1 2 1 2 1 1 3 4 1 1 5 1 1 6 1 1 1 1 1 1 1 2 3 4 1 2 ...
result:
ok Correct (1002 test cases)
Test #30:
score: 0
Accepted
time: 12ms
memory: 3704kb
input:
1003 95 16 1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 1 1 526 3 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
1 1 1 1 2 3 1 2 3 1 1 1 2 3 1 2 3 1 1 2 3 1 1 1 1 4 1 2 3 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 1 4 5 1 2 3 4 1 2 1 1 3 4 6 7 1 2 1 2 1 2 3 1 1 4 5 6 7 1 1 1 1 1 2 3 4 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 3 1 2 1 2 1 1 1 2 1 1 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 3 1 2 3 1 1 1...
result:
ok Correct (1003 test cases)
Test #31:
score: 0
Accepted
time: 21ms
memory: 3672kb
input:
1004 322 257 -1 1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 -1 1 -1...
output:
1 1 2 3 4 5 6 1 2 1 2 1 2 3 1 1 4 1 1 1 1 5 6 1 2 3 4 5 6 1 1 7 1 1 1 1 1 1 8 1 1 1 1 9 10 1 1 11 1 2 1 1 1 2 1 2 3 1 1 1 1 1 1 1 2 3 1 1 12 13 1 2 1 2 1 2 3 1 2 3 14 15 16 17 1 2 1 2 18 19 20 21 22 23 1 2 3 1 1 1 1 1 2 1 2 4 1 1 1 2 3 4 1 2 1 1 3 1 1 1 1 1 1 4 1 2 1 1 3 1 2 1 1 1 1 1 2 4 1 2 1 1 1 ...
result:
ok Correct (1004 test cases)
Test #32:
score: 0
Accepted
time: 21ms
memory: 3940kb
input:
1005 508 4 1 -1 -1 -1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 1 1 1 1 1 1 2 3 1 1 4 5 6 1 1 7 1 1 1 2 1 1 3 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 1 1 1 1 1 1 2 1 1 3 1 2 3 1 1 1 2 1 2 1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 1 1 1 1 1 4 1 1 5 1 1 1 2 3...
result:
ok Correct (9995 test cases)
Test #34:
score: 0
Accepted
time: 24ms
memory: 3640kb
input:
9996 27 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1 7 2 1 1 1 1 -1 -1 1 22 3 -1 -1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 37 4 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 1 1 1 7 1 -1 1 -1 -1 1 1 1 29 1 -1 -1 1 -1 1 -1 1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 1 1 2 1 2 1 1 2 3 1 2 3 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 2 3 4 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 1 2 3 4 5 1 1 2 1 1...
result:
ok Correct (9996 test cases)
Test #35:
score: 0
Accepted
time: 28ms
memory: 3840kb
input:
9997 15 9 -1 1 1 -1 1 1 -1 1 -1 1 1 1 1 1 1 1 1 1 37 20 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 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 1 1 2 3 1 1 1 1 1 2 3 1 1 1 1 1 1 1 1 2 3 1 2 3 1 2 3 1 1 1 1 1 2 3 1 2 1 2 1 2 3 1 1 1 1 1 1 1 1 ...
result:
ok Correct (9998 test cases)
Test #37:
score: 0
Accepted
time: 22ms
memory: 3816kb
input:
9999 65 2 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 -1 1 1 1 1 1 1 1 1 12 3 1 1 1 1 -1 -1 -1 -1 1 1 -1 -1 75 2 1 -1 1 -1 -1 -1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 1 1...
output:
1 1 1 2 1 2 1 1 1 1 1 1 2 1 2 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 2 3 1 1 1 2 3 1 2 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 ...
result:
ok Correct (9999 test cases)
Test #38:
score: 0
Accepted
time: 14ms
memory: 3576kb
input:
10000 15 3 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 3 3 -1 1 1 34 2 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 3 2 1 1 -1 25 2 -1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 11 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 29 2 -1 -1 -1 1 -1 1 -1 -1 -1 -1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 2 1 1 1 1 1 1 1 2 1 2 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 1 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok Correct (10000 test cases)
Extra Test:
score: 0
Extra Test Passed