QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#387006 | #5109. Spider Walk | Energy_is_not_over# | AC ✓ | 1072ms | 16080kb | C++17 | 10.2kb | 2024-04-11 22:56:48 | 2024-04-11 22:56:49 |
Judging History
answer
//
// Stvoreno ENERGom o 11.04.24. 15:06:59
//
#include <bits/stdc++.h>
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define F first
#define fir first
#define S second
#define sec second
#define mp make_pair
#define MP make_pair
#define pb push_back
#define PB push_back
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
#ifdef Energy
#define DEBUG for (int _____DEBUG=1;_____DEBUG;_____DEBUG=0)
template<class ...Ts>
auto &PRNT(Ts ...ts) { return ((cerr << ts << " "), ...); }
#define LOG(...) PRNT(#__VA_ARGS__" ::",__VA_ARGS__)<<endl
#else
#define DEBUG while (0)
#define LOG(...)
#endif
const int max_n = 2e5+10, inf = 1000111222;
struct segment_tree {
int T[4 * max_n];
int T_min[4 * max_n];
int T_max[4 * max_n];
void update(int v, int l, int r, int pos, int val) {
if (l == r) {
T[v] += val;
T_min[v] += val;
T_max[v] += val;
return;
}
int m = (l + r) / 2;
if (pos <= m) {
update(2 * v, l, m, pos, val);
} else {
update(2 * v + 1, m + 1, r, pos, val);
}
T[v] = T[v * 2] + T[v * 2 + 1];
T_min[v] = min(T_min[2 * v], T_min[2 * v + 1]);
T_max[v] = max(T_max[2 * v], T_max[2 * v + 1]);
}
int get_sum(int v, int l, int r, int tl, int tr) {
if (l > tr || r < tl) {
return 0;
}
if (l >= tl && r <= tr) {
return T[v];
}
int m = (l + r) / 2;
return get_sum(2 * v, l, m, tl, tr) +
get_sum(2 * v + 1, m + 1, r, tl, tr);
}
int get_righttest_not_minus_one(int v, int l, int r, int tl, int tr)
{
if (l > tr || r < tl) {
return -1;
}
if (l >= tl && r <= tr) {
if (T_max[v]!=-1){
while (l!=r){
int m=(l+r)/2;
if (T_max[2*v+1]!=-1){
v=2*v+1;
l=m+1;
}
else if (T_max[2*v]!=-1){
v=2*v;
r=m;
}
else{
assert(0);
}
}
return l;
}
else{
return -1;
}
}
int m = (l + r) / 2;
int res=get_righttest_not_minus_one(2 * v + 1, m + 1, r, tl, tr);
if (res==-1){
res=get_righttest_not_minus_one(2 * v, l, m, tl, tr);
}
return res;
}
int get_lefttest_not_one(int v, int l, int r, int tl, int tr)
{
if (l > tr || r < tl) {
return -1;
}
if (l >= tl && r <= tr) {
if (T_min[v]!=1){
while (l!=r){
int m=(l+r)/2;
if (T_min[2*v]!=1){
v=2*v;
r=m;
}
else if (T_min[2*v+1]!=1){
v=2*v+1;
l=m+1;
}
else{
assert(0);
}
}
return l;
}
else{
return -1;
}
}
int m = (l + r) / 2;
int res=get_lefttest_not_one(2 * v, l, m, tl, tr);
if (res==-1){
res=get_lefttest_not_one(2 * v + 1, m + 1, r, tl, tr);
}
return res;
}
};
segment_tree st;
int main() {
// freopen("input.txt","r",stdin);
// freopen("output1.txt","w",stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,m,s;
cin>>n>>m>>s;
s--;
vector<pii> guys;
guys.reserve(m);
for (int i=0;i<m;i++){
int d,t;
cin>>d>>t;
t--;
guys.pb(mp(d,t));
}
sort(all(guys));
reverse(all(guys));
/// magic
auto magic___sum_of_differences=[&](int l,int r)
{
return st.get_sum(1,0,n-1,l,r);
};
int magic_value_of_zero=0;
auto magic_get=[&](int pos)
{
assert(0<=pos && pos<n);
return magic_value_of_zero+(pos==0?0:magic___sum_of_differences(0,pos-1));
};
auto magic___increment_difference_naive=[&](int pos,int val)
{
st.update(1,0,n-1,pos,val);
};
auto magic_increment_on_segment=[&](int l,int r,int val)
{
magic___increment_difference_naive((l-1+n)%n,+val);
magic___increment_difference_naive(r,-val);
if (l<=0 && r>=0){
magic_value_of_zero+=val;
}
};
auto magic_set_naive=[&](int pos,int val)
{
assert(0<=pos && pos<n);
if (pos==0){
magic___increment_difference_naive(0,+magic_value_of_zero-val);
magic___increment_difference_naive(n-1,-magic_value_of_zero+val);
magic_value_of_zero=val;
}
else{
const int before=magic_get(pos);
magic___increment_difference_naive(pos,+before-val);
magic___increment_difference_naive((pos-1+n)%n,-before+val);
}
};
auto magic_init=[&](vector<int> init_ans)
{
for (int i=0;i<n;i++){
magic_set_naive(i,init_ans[i]);
}
};
auto magic_do_smart_to_left=[&](int pos)
{
LOG("magic_do_smart_to_left");
int prev_val=magic_get((pos-1+n)%n);
int my_val=magic_get(pos);
auto get_best_to_left_local=[&](int pos)
{
if (pos==0){
return 0;
}
LOG("doing ",pos,st.get_righttest_not_minus_one(1,0,n-1,0,pos-1));
return st.get_righttest_not_minus_one(1,0,n-1,0,pos-1)+1;
// while (pos>0 && NAIVE_diff[pos-1]==-1){
// pos--;
// }
// return pos;
};
if (prev_val>my_val+1){
LOG("doing 1");
assert(prev_val==my_val+2);
int best_good=get_best_to_left_local((pos-1+n)%n);
LOG(best_good);
magic_increment_on_segment(best_good,(pos-1+n)%n,-1);
if (best_good==0){
LOG("doing 2");
const int first_val=magic_get(0);
const int last_val=magic_get(n-1);
if (last_val>first_val+1){
LOG("doing 3");
assert(last_val==first_val+2);
best_good=get_best_to_left_local(n-1);
LOG(best_good);
magic_increment_on_segment(best_good,n-1,-1);
}
}
}
};
auto magic_do_smart_to_right=[&](int pos)
{
LOG("magic_do_smart_to_right");
int nxt_val=magic_get((pos+1+n)%n);
int my_val=magic_get(pos);
auto get_best_to_right_local=[&](int pos)
{
if (pos==n-1){
return n-1;
}
int res=st.get_lefttest_not_one(1,0,n-1,pos,n-1);
if (res==-1){
return n-1;
}
else {
return res;
}
// while (pos>0 && NAIVE_diff[pos-1]==-1){
// pos--;
// }
// return pos;
};
if (nxt_val>my_val+1){
LOG("doing 1");
assert(nxt_val==my_val+2);
int best_good=get_best_to_right_local((pos+1+n)%n);
LOG(best_good);
magic_increment_on_segment((pos+1+n)%n,best_good,-1);
if (best_good==n-1){
LOG("doing 2");
const int first_val=magic_get(0);
const int last_val=magic_get(n-1);
if (first_val>last_val+1){
LOG("doing 3");
assert(first_val==last_val+2);
best_good=get_best_to_right_local(0);
LOG(best_good);
magic_increment_on_segment(0,best_good,-1);
}
}
}
};
/// magic
vector<int> ans(n);
for (int i=0;i<n;i++){
ans[i]=min(abs(i-s),n-abs(i-s));
}
magic_init(ans);
DEBUG{
cerr<<"init"<<"\n";
for (int i=0;i<n;i++){
cerr<<ans[i]<<" ";
}
cerr<<"\n";
};
for (auto i:guys){
const int pos=i.sec;
const int nxt=(pos+1)%n;
LOG(pos,nxt);
int pos_val=magic_get(pos);
int nxt_val=magic_get(nxt);
if (pos_val==nxt_val){
continue;
}
assert(abs(pos_val-nxt_val)==1);
{
swap(pos_val,nxt_val);
magic_set_naive(pos,pos_val);
magic_set_naive(nxt,nxt_val);
}
if (pos_val<nxt_val){
const int nxt_nxt_val=magic_get((nxt+1)%n);
if (nxt_val>nxt_nxt_val+1){
magic_set_naive(nxt,nxt_nxt_val+1);
nxt_val=nxt_nxt_val+1;
}
magic_do_smart_to_left(pos);
// int cur=(pos-1+n)%n;
// while (ans[cur]>ans[(cur+1)%n]+1){
// ans[cur]=ans[(cur+1)%n]+1;
// cur=(cur-1+n)%n;
// }
}
else{
const int prev_pos_val=magic_get((pos-1+n)%n);
if (pos_val>prev_pos_val+1){
magic_set_naive(pos,prev_pos_val+1);
pos_val=prev_pos_val+1;
}
magic_do_smart_to_right(nxt);
// int cur=(nxt+1+n)%n;
// while (ans[cur]>ans[(cur-1)%n]+1){
// ans[cur]=ans[(cur-1)%n]+1;
// cur=(cur+1+n)%n;
// }
}
DEBUG{
for (int i=0;i<n;i++){
cerr<<magic_get(i)<<" ";
}
cerr<<"\n";
cerr<<"diffs are :: "<<"\n";
for (int i=0;i<n;i++){
cerr<<st.get_sum(1,0,n-1,i,i)<<" ";
}
cerr<<"\n";
};
}
for (int i=0;i<n;i++){
cout<<magic_get(i)<<"\n";
}
exit(0);
}
详细
Test #1:
score: 100
Accepted
time: 611ms
memory: 14804kb
input:
200000 500000 116205 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50...
output:
2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 200000 lines
Test #2:
score: 0
Accepted
time: 1028ms
memory: 14852kb
input:
200000 500000 200000 1 148896 2 178903 3 36800 4 98361 5 79634 6 29266 7 51632 8 166082 9 66246 10 145043 11 41644 12 81858 13 87530 14 199625 15 127160 16 49786 17 181673 18 48403 19 30274 20 101455 21 105100 22 52149 23 22810 24 79308 25 191579 26 96365 27 154697 28 45255 29 64965 30 192604 31 330...
output:
1 0 1 1 2 2 3 3 4 5 6 7 8 8 9 10 11 12 12 11 12 13 14 15 16 17 18 17 18 19 20 21 21 22 23 24 25 26 27 28 27 28 28 29 30 31 31 32 32 33 34 35 36 37 38 39 40 41 42 42 43 44 45 46 47 48 49 50 51 52 52 53 54 55 56 57 58 59 59 60 61 62 61 62 63 64 65 66 66 67 67 68 68 69 70 70 71 72 73 74 75 76 76 77 78 ...
result:
ok 200000 lines
Test #3:
score: 0
Accepted
time: 1038ms
memory: 14620kb
input:
189566 481938 180576 30827 77075 266878 6648 251124 43809 22925 151090 165947 34594 248343 179640 217340 68611 1607 145089 312862 151436 72904 160893 55989 147148 189122 110726 408438 184618 461208 122245 404636 154726 148242 165504 8878 31007 300131 17893 433102 58524 388216 49111 307221 65807 1774...
output:
8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 ...
result:
ok 189566 lines
Test #4:
score: 0
Accepted
time: 1055ms
memory: 14648kb
input:
181447 483992 86977 107095 161626 239957 140211 424191 79709 399773 77498 277365 32886 190721 131207 240187 140835 218366 6622 33108 76258 330939 140453 164405 119170 476970 49217 21280 120632 97648 159438 135504 178839 359378 170055 274161 44870 119531 84308 166512 22284 271134 116871 87409 101513 ...
output:
86033 86032 86031 86030 86029 86028 86027 86026 86025 86024 86023 86022 86021 86020 86019 86018 86017 86017 86016 86015 86014 86013 86012 86011 86010 86009 86008 86007 86006 86005 86004 86003 86002 86001 86000 85999 85999 85998 85997 85996 85995 85994 85993 85992 85991 85990 85989 85988 85987 85986 ...
result:
ok 181447 lines
Test #5:
score: 0
Accepted
time: 1058ms
memory: 14732kb
input:
195153 485788 144721 236773 79509 21067 193469 70032 64012 115841 94316 441994 170487 254008 73824 15719 149849 149019 42687 319803 96050 15572 85169 221032 166626 263567 129112 481345 30567 196136 72472 353791 116691 381823 63302 148833 167407 29637 83950 465166 890 251729 126907 118528 48333 33916...
output:
49751 49752 49753 49754 49755 49756 49757 49758 49759 49760 49761 49762 49763 49764 49765 49766 49767 49768 49769 49770 49771 49772 49773 49774 49775 49776 49777 49778 49779 49780 49781 49782 49783 49784 49785 49785 49786 49787 49788 49789 49790 49791 49792 49793 49794 49795 49796 49797 49798 49799 ...
result:
ok 195153 lines
Test #6:
score: 0
Accepted
time: 1042ms
memory: 14588kb
input:
197774 483393 29746 18872 149821 450931 177715 210877 136858 323080 63220 351900 20445 459492 145884 213811 98165 187008 121361 129871 12169 181958 146298 327983 154551 52067 162120 458287 165031 192873 37885 352643 166249 237832 86303 42700 51776 475167 48674 283740 53807 444953 51022 42163 143542 ...
output:
29217 29216 29215 29214 29213 29212 29211 29210 29209 29208 29207 29206 29205 29204 29203 29202 29201 29200 29199 29198 29197 29196 29195 29195 29194 29193 29192 29191 29190 29189 29188 29187 29186 29185 29184 29183 29182 29181 29180 29179 29179 29178 29177 29176 29175 29174 29173 29172 29171 29170 ...
result:
ok 197774 lines
Test #7:
score: 0
Accepted
time: 1059ms
memory: 15652kb
input:
180086 496736 172904 406742 79599 188804 145697 110531 106380 317569 121463 210917 97354 387447 57317 376923 99364 63860 45221 348954 140547 18227 69921 482351 3995 115113 64797 350742 44088 294354 72227 269542 107964 227349 21206 49138 136863 80627 165580 421308 17013 283150 21793 370434 146201 104...
output:
6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 ...
result:
ok 180086 lines
Test #8:
score: 0
Accepted
time: 1064ms
memory: 14584kb
input:
180486 496666 120551 348759 142728 241289 139060 173116 76810 379172 112772 364690 8703 470333 50318 147686 91026 454474 66378 173253 21460 313484 156128 421679 164967 213937 23984 77482 155306 484849 116127 356293 4793 365143 17949 279657 149120 461078 119722 337822 101134 59249 112763 196098 15587...
output:
59127 59128 59129 59130 59131 59132 59133 59134 59135 59136 59137 59138 59139 59140 59141 59142 59143 59144 59145 59146 59147 59148 59149 59150 59151 59152 59153 59154 59155 59156 59157 59158 59159 59160 59161 59162 59163 59164 59165 59166 59167 59168 59169 59170 59171 59172 59173 59174 59175 59176 ...
result:
ok 180486 lines
Test #9:
score: 0
Accepted
time: 1072ms
memory: 14412kb
input:
181124 490456 50365 199583 36908 481362 31855 356400 149181 414196 169886 430627 88790 64118 148572 161393 101173 163953 23382 301778 112440 345466 163560 463619 156870 28607 134499 474434 109355 42208 96509 196260 43458 80994 61153 114023 148 377755 2610 18031 70474 97378 137754 353876 59752 210297...
output:
49647 49646 49645 49644 49643 49642 49641 49640 49639 49638 49637 49636 49635 49634 49633 49632 49631 49630 49629 49629 49628 49627 49626 49625 49624 49623 49622 49621 49620 49619 49618 49617 49616 49615 49614 49613 49612 49611 49610 49609 49608 49607 49606 49605 49604 49603 49602 49601 49600 49599 ...
result:
ok 181124 lines
Test #10:
score: 0
Accepted
time: 1030ms
memory: 14740kb
input:
197590 484154 61850 397470 54183 11207 121053 222200 168119 150357 169293 58235 80907 327689 80002 98541 182007 336215 104438 22431 126187 152619 107480 174031 19547 277576 120066 465710 110748 49822 44754 220403 154825 344411 41558 323739 76613 455832 191834 352181 21028 472725 88952 458357 48531 1...
output:
61083 61082 61081 61080 61079 61078 61077 61076 61075 61074 61073 61072 61071 61070 61069 61068 61067 61066 61065 61064 61063 61062 61061 61060 61059 61058 61057 61056 61055 61054 61053 61052 61051 61050 61049 61048 61047 61046 61045 61044 61043 61042 61041 61040 61039 61038 61037 61036 61035 61034 ...
result:
ok 197590 lines
Test #11:
score: 0
Accepted
time: 1062ms
memory: 16080kb
input:
199644 497152 11134 300270 62537 110682 82792 374411 134819 90234 68326 205863 22595 282479 149737 345817 124717 81153 11603 168807 126485 389402 95854 88668 118722 149927 67971 172141 97882 481957 45894 398112 36862 124968 101637 389218 61168 319906 28803 128485 170861 171975 140124 82268 19022 287...
output:
10814 10813 10812 10811 10810 10809 10808 10807 10806 10805 10804 10803 10802 10801 10800 10799 10798 10798 10797 10796 10795 10794 10793 10792 10791 10790 10789 10788 10787 10786 10785 10784 10783 10782 10781 10780 10779 10778 10777 10776 10775 10774 10773 10772 10771 10770 10769 10768 10767 10766 ...
result:
ok 199644 lines
Test #12:
score: 0
Accepted
time: 1038ms
memory: 15648kb
input:
196569 482180 36587 461381 11344 277557 52583 125147 124149 408524 105138 264163 59439 140948 78483 164017 12010 334315 122982 244245 23940 23481 45595 397255 182921 75605 168555 446300 166365 166523 172659 158052 142281 278803 144282 86967 24206 399724 133740 244010 72535 429869 130830 193090 23192...
output:
35998 35997 35996 35995 35994 35993 35992 35991 35990 35989 35988 35987 35986 35985 35984 35983 35982 35981 35980 35979 35978 35977 35976 35975 35974 35973 35973 35972 35971 35970 35969 35968 35967 35966 35965 35964 35963 35962 35961 35960 35959 35958 35957 35956 35955 35954 35953 35952 35951 35950 ...
result:
ok 196569 lines
Test #13:
score: 0
Accepted
time: 1025ms
memory: 14724kb
input:
190921 489746 42967 391562 8760 129650 100895 452166 123913 119067 56714 373602 11380 478214 176748 407810 181733 57285 31087 422861 147649 448361 175577 219834 64194 313640 50668 350974 3977 247679 180839 329081 155321 74881 40848 478182 37019 215300 79555 9405 53702 168393 25302 236477 93619 25603...
output:
42322 42321 42320 42319 42318 42317 42316 42315 42314 42313 42312 42311 42310 42309 42308 42307 42306 42305 42304 42303 42302 42301 42300 42299 42298 42297 42296 42295 42294 42293 42292 42291 42290 42289 42288 42287 42286 42285 42284 42283 42282 42281 42280 42279 42278 42277 42276 42275 42274 42273 ...
result:
ok 190921 lines
Test #14:
score: 0
Accepted
time: 1023ms
memory: 15616kb
input:
184737 492080 22055 144000 9096 354539 123574 16430 11461 228088 163684 190107 119807 132384 154770 404019 1958 490750 169154 387522 42131 136316 93984 101366 170970 356666 1829 332191 94207 355824 177867 489836 7492 13912 3354 380471 74986 414263 132631 305038 136733 453722 176628 22631 94250 90608...
output:
21592 21591 21590 21589 21588 21587 21586 21585 21584 21583 21583 21582 21581 21580 21579 21578 21577 21576 21575 21574 21573 21572 21571 21570 21569 21568 21567 21566 21565 21564 21563 21562 21561 21560 21559 21558 21557 21556 21555 21554 21553 21552 21551 21550 21549 21548 21547 21546 21545 21544 ...
result:
ok 184737 lines
Test #15:
score: 0
Accepted
time: 1057ms
memory: 14672kb
input:
181021 491637 34614 39883 48401 93237 21082 45579 92609 358808 119983 312012 71142 297623 110439 317317 160786 262661 162113 434475 43339 18394 11393 125549 41859 81144 54728 448594 61999 196157 77418 328583 128130 222352 39498 462050 106529 275765 144640 196127 18113 66601 109683 106225 6247 123832...
output:
34009 34008 34007 34006 34005 34004 34003 34002 34001 34000 33999 33998 33997 33996 33995 33994 33993 33992 33991 33990 33989 33988 33987 33986 33985 33984 33983 33982 33981 33980 33979 33978 33977 33976 33975 33974 33973 33972 33971 33970 33969 33968 33967 33966 33965 33964 33963 33962 33961 33960 ...
result:
ok 181021 lines
Test #16:
score: 0
Accepted
time: 1018ms
memory: 14396kb
input:
188355 480153 32115 97988 105954 36644 140468 18306 181127 278687 14606 37648 136264 32713 68588 75367 99864 304637 34742 145385 69534 301020 97799 199249 156428 96842 92887 370748 100875 104861 17389 455328 6238 269200 21738 7519 77241 20493 15656 1201 180344 435928 131815 3877 115422 396496 123187...
output:
31556 31555 31554 31553 31552 31551 31550 31549 31548 31547 31546 31545 31544 31543 31542 31541 31540 31539 31538 31537 31537 31536 31535 31534 31533 31532 31531 31530 31529 31528 31527 31526 31525 31524 31523 31522 31521 31520 31519 31518 31517 31516 31515 31514 31513 31512 31511 31510 31509 31508 ...
result:
ok 188355 lines
Test #17:
score: 0
Accepted
time: 1064ms
memory: 14560kb
input:
193370 486893 56903 353736 133323 228377 19249 40916 15457 337992 104614 127958 26050 95621 40524 323588 129100 196733 79324 44898 51330 199567 17625 369507 36182 378578 164713 191488 56587 74522 47952 119251 130683 202230 12213 346223 10220 633 104827 205384 123985 238776 167280 393142 30231 284392...
output:
56159 56158 56157 56156 56155 56154 56153 56152 56151 56150 56149 56148 56147 56146 56145 56144 56143 56142 56141 56140 56139 56138 56137 56136 56135 56134 56133 56132 56131 56130 56129 56128 56127 56126 56125 56124 56123 56122 56121 56120 56119 56118 56117 56116 56115 56114 56113 56112 56111 56110 ...
result:
ok 193370 lines
Test #18:
score: 0
Accepted
time: 1040ms
memory: 14632kb
input:
186278 483274 52177 263747 66032 178104 116508 199672 168486 108303 34792 333033 23291 287749 169173 10929 63823 31141 48027 244952 137649 379388 15618 196528 73143 62210 121409 275009 64167 166759 172206 224626 31076 277479 19639 292114 121341 310092 79271 210104 73550 4300 81370 432156 181073 4235...
output:
51450 51449 51448 51447 51446 51445 51444 51443 51442 51442 51441 51440 51439 51438 51437 51436 51435 51434 51433 51432 51431 51430 51429 51428 51427 51426 51425 51424 51423 51422 51421 51420 51419 51418 51417 51416 51415 51414 51413 51412 51411 51410 51409 51408 51407 51406 51405 51404 51403 51402 ...
result:
ok 186278 lines
Test #19:
score: 0
Accepted
time: 1050ms
memory: 14572kb
input:
184216 496672 76398 38513 105119 485115 4087 260084 170829 53850 168791 320119 6335 171499 78778 60290 137601 197961 7506 185333 113963 262860 42008 186884 103061 475184 56202 91782 58666 96637 84193 120930 130743 87798 98888 105253 6373 21919 122227 358468 80733 248934 103650 315036 28927 16928 302...
output:
75518 75517 75516 75515 75514 75513 75512 75511 75510 75509 75508 75507 75506 75505 75504 75503 75502 75501 75500 75499 75498 75497 75496 75495 75494 75493 75492 75491 75490 75489 75488 75487 75486 75485 75484 75483 75482 75481 75480 75479 75478 75477 75476 75475 75474 75473 75472 75471 75470 75469 ...
result:
ok 184216 lines
Test #20:
score: 0
Accepted
time: 1023ms
memory: 14568kb
input:
194052 482329 8484 414637 10965 317872 82435 322540 136351 369962 187899 242062 173266 453620 8665 394882 45754 66529 107900 96596 26195 168902 125488 76039 164409 228305 62341 469966 53581 12844 29075 75325 11082 152618 184270 444991 80116 101880 69569 265900 73822 145432 138624 264229 113297 32525...
output:
8205 8204 8203 8202 8201 8200 8199 8198 8197 8196 8195 8194 8193 8192 8191 8190 8189 8188 8187 8186 8185 8184 8183 8182 8181 8180 8179 8178 8177 8176 8175 8174 8173 8172 8171 8170 8169 8168 8167 8166 8165 8164 8163 8162 8161 8160 8159 8158 8157 8156 8155 8154 8153 8152 8151 8150 8149 8148 8147 8147 ...
result:
ok 194052 lines
Test #21:
score: 0
Accepted
time: 1015ms
memory: 14588kb
input:
184338 482574 172302 429744 39105 924 160077 172336 152399 144864 51792 375995 123209 206379 155482 110978 155294 348075 101548 262374 129359 462865 167459 83957 3732 47257 170063 446566 88587 265923 144135 263346 59732 405710 11204 106426 21545 55686 51395 347437 146433 227793 123010 1612 85916 457...
output:
11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 ...
result:
ok 184338 lines
Test #22:
score: 0
Accepted
time: 1068ms
memory: 14740kb
input:
187146 498932 81514 55081 119166 242924 88640 341067 184380 318906 184676 14960 160726 327304 39386 354504 65933 400512 155803 127532 150410 157141 39552 12920 135455 323102 115475 5377 151080 330104 98763 371106 160180 435308 142033 229008 34080 242454 20385 157202 158801 180612 36298 46423 54211 1...
output:
80600 80599 80598 80597 80596 80595 80594 80593 80592 80591 80590 80589 80588 80587 80586 80585 80584 80583 80582 80581 80580 80579 80578 80577 80576 80575 80574 80573 80572 80571 80570 80569 80568 80567 80566 80565 80564 80563 80562 80561 80560 80559 80558 80557 80556 80555 80554 80553 80552 80551 ...
result:
ok 187146 lines
Test #23:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
30 2 2 2 29 4 20
output:
1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 14 13 12 11 10 9 8 7 6 5 4 3 2 2
result:
ok 30 lines
Test #24:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
20 2 2 1 16 2 2
output:
1 1 0 1 2 3 4 5 6 7 8 9 8 7 6 5 5 4 3 2
result:
ok 20 lines
Test #25:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
10 4 1 1 1 2 2 3 3 4 4
output:
1 0 1 2 3 4 4 3 2 1
result:
ok 10 lines
Test #26:
score: 0
Accepted
time: 73ms
memory: 11980kb
input:
200000 0 12345
output:
12344 12343 12342 12341 12340 12339 12338 12337 12336 12335 12334 12333 12332 12331 12330 12329 12328 12327 12326 12325 12324 12323 12322 12321 12320 12319 12318 12317 12316 12315 12314 12313 12312 12311 12310 12309 12308 12307 12306 12305 12304 12303 12302 12301 12300 12299 12298 12297 12296 12295 ...
result:
ok 200000 lines
Test #27:
score: 0
Accepted
time: 247ms
memory: 14868kb
input:
200000 500000 2 999500001 3 999500002 2 999500003 2 999500004 2 999500005 2 999500006 2 999500007 2 999500008 2 999500009 2 999500010 2 999500011 2 999500012 2 999500013 2 999500014 2 999500015 2 999500016 2 999500017 2 999500018 2 999500019 2 999500020 2 999500021 2 999500022 2 999500023 2 99950002...
output:
1 0 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...
result:
ok 200000 lines
Test #28:
score: 0
Accepted
time: 225ms
memory: 14892kb
input:
200000 500000 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 ...
output:
0 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok 200000 lines
Test #29:
score: 0
Accepted
time: 1028ms
memory: 14760kb
input:
198932 489574 85746 1 142326 2 124019 3 155534 4 6247 5 125073 6 112770 7 128908 8 19483 9 190128 10 29997 11 171311 12 66842 13 91270 14 112384 15 104018 16 105128 17 82110 18 41511 19 139706 20 121770 21 23861 22 85671 23 114008 24 112556 25 13114 26 190753 27 75786 28 87723 29 70259 30 125609 31 ...
output:
84837 84836 84835 84834 84833 84832 84831 84830 84829 84828 84827 84826 84825 84824 84823 84822 84821 84820 84819 84818 84817 84816 84815 84814 84813 84812 84811 84810 84809 84808 84807 84806 84805 84804 84803 84802 84801 84800 84799 84798 84797 84796 84795 84794 84793 84792 84791 84790 84789 84788 ...
result:
ok 198932 lines
Test #30:
score: 0
Accepted
time: 548ms
memory: 14936kb
input:
200000 500000 1 500000 2 499999 3 499998 4 499997 5 499996 6 499995 7 499994 8 499993 9 499992 10 499991 11 499990 12 499989 13 499988 14 499987 15 499986 16 499985 17 499984 18 499983 19 499982 20 499981 21 499980 22 499979 23 499978 24 499977 25 499976 26 499975 27 499974 28 499973 29 499972 30 49...
output:
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
ok 200000 lines
Test #31:
score: 0
Accepted
time: 218ms
memory: 14832kb
input:
200000 500000 1 99999999 1 99999998 2 99999997 3 99999996 4 99999995 5 99999994 6 99999993 7 99999992 8 99999991 9 99999990 10 99999989 11 99999988 12 99999987 13 99999986 14 99999985 15 99999984 16 99999983 17 99999982 18 99999981 19 99999980 20 99999979 21 99999978 22 99999977 23 99999976 24 99999...
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 200000 lines
Test #32:
score: 0
Accepted
time: 175ms
memory: 14880kb
input:
200000 500000 2 951000098 199994 951000196 200000 951000294 200000 951000392 199990 951000490 199995 951000588 199997 951000686 199991 951000784 199991 951000882 199997 951000980 199994 951001078 199996 951001176 200000 951001274 199998 951001372 199990 951001470 199997 951001568 199992 951001666 19...
output:
1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok 200000 lines
Test #33:
score: 0
Accepted
time: 254ms
memory: 14804kb
input:
200000 500000 2 1 2 2 1 3 2 4 1 5 2 6 1 7 2 8 1 9 2 10 1 11 2 12 1 13 2 14 1 15 2 16 1 17 2 18 1 19 2 20 1 21 2 22 1 23 2 24 1 25 2 26 1 27 2 28 1 29 2 30 1 31 2 32 1 33 2 34 1 35 2 36 1 37 2 38 1 39 2 40 1 41 2 42 1 43 2 44 1 45 2 46 1 47 2 48 1 49 2 50 1 51 2 52 1 53 2 54 1 55 2 56 1 57 2 58 1 59 ...
output:
0 1 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...
result:
ok 200000 lines
Extra Test:
score: 0
Extra Test Passed