QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#220906 | #147. Floppy | Ahmed57# | 28 | 178ms | 4460kb | C++20 | 1.1kb | 2023-10-20 23:04:56 | 2024-07-04 02:20:50 |
Judging History
floppy
#include <bits/stdc++.h>
using namespace std;
#include "floppy.h"
void read_array(int subtask_id,const std::vector<int> &v){
vector<pair<int,int>> xd;
for(int i = 0;i<v.size();i++)xd.push_back({v[i],i});
int e = log2(v.size());
sort(xd.begin(),xd.end());
reverse(xd.begin(),xd.end());
string b;
for(auto i : xd){
for(int d = e;d>=0;d--){
if(i.second&(1<<d))b+='1';
else b+='0';
}
}
save_to_floppy(b);
}
vector<int>solve_queries(int subtask_id,int N,const std::string &bits,const std::vector<int> &a,const std::vector<int> &b){
int x = log2(N);
int lol[N] = {0};
for(int i = 0;i<N;i++){
int id = 0;
for(int d = x;d>=0;d--){
if(bits[i*(x+1)+(x-d)]=='1')id|=(1<<d);
}
lol[id] = N-i-1;
}
vector<int> ans;
for(int i = 0;i<a.size();i++){
int ind = 0 , ma = -1;
for(int j = a[i];j<=b[i];j++){
if(ma<lol[j]){
ma = lol[j];
ind = j;
}
}
ans.push_back(ind);
}
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 7
Accepted
Test #1:
score: 7
Accepted
time: 2ms
memory: 3860kb
input:
1 496 484 491 478 483 452 446 458 493 453 457 468 418 440 241 267 365 462 441 495 39 54 70 26 97 152 24 105 85 170 298 42 275 305 295 297 207 211 296 184 346 98 123 171 157 135 194 243 156 115 196 169 53 138 93 263 251 201 195 333 324 396 338 270 311 359 289 290 486 403 183 339 310 473 464 471 469 4...
output:
4464 0000100100011100110000001111001100010000000011001110001111010111001101000011001100010000111001101010000000000000000110011010101000111110110010010011010000000000100010111000010011000011001110011111010010010000011111110010010101001101110010010110000010101111011111001101101001001110010010011001010...
input:
1 496 4464 0000100100011100110000001111001100010000000011001110001111010111001101000011001100010000111001101010000000000000000110011010101000111110110010010011010000000000100010111000010011000011001110011111010010010000011111110010010101001101110010010110000010101111011111001101101001001110010010011...
output:
115 18 115 305 115 18 305 373 115 305 115 373 115 115 305 365 373 461 305 305 18 115 429 201 305 305 115 39 67 18 115 115 305 305 115 373 115 352 67 305 115 373 115 453 18 67 18 305 373 115 115 429 373 252 115 125 115 201 115 491 115 305 115 18 305 305 287 305 115 305 18 201 115 373 370 305 305 201 ...
result:
ok good job! L = 4464
Test #2:
score: 7
Accepted
time: 0ms
memory: 4108kb
input:
1 496 466 469 320 402 391 453 73 101 122 49 54 94 93 148 197 168 233 144 125 161 69 34 247 76 37 90 71 33 42 212 188 156 110 135 165 374 277 289 248 273 236 131 210 242 238 231 366 346 314 358 300 349 322 412 315 268 354 340 99 176 290 313 221 229 332 265 269 146 316 403 369 492 190 256 266 100 126 ...
output:
4464 1010100111110001110011011010010001111100111011010110101000000001001101101001100011100110111010101100110111101111001001010101110110101011101010011001111011110011001010011110111001111010101011001101000011001100110110000011001111010101000000000010011010001010010110000000001111010000111001001110010...
input:
1 496 4464 1010100111110001110011011010010001111100111011010110101000000001001101101001100011100110111010101100110111101111001001010101110110101011101010011001111011110011001010011110111001111010101011001101000011001100110110000011001111010101000000000010011010001010010110000000001111010000111001001...
output:
339 339 339 389 222 339 256 256 339 180 339 339 339 310 109 71 339 365 256 256 171 455 484 264 200 339 256 413 339 339 339 339 339 339 109 339 256 109 339 222 339 339 109 339 109 339 455 346 109 213 339 53 339 339 109 339 339 339 109 339 339 339 339 339 339 109 109 339 256 109 339 256 310 109 339 10...
result:
ok good job! L = 4464
Test #3:
score: 7
Accepted
time: 0ms
memory: 3888kb
input:
1 496 487 495 488 494 486 493 490 492 485 491 483 489 484 482 480 481 479 478 477 475 476 473 474 472 470 471 466 469 468 465 467 464 462 463 458 461 459 460 457 456 455 454 453 451 452 449 450 448 447 444 446 445 442 443 441 434 440 438 439 437 435 436 433 431 432 429 430 424 428 423 427 426 422 42...
output:
4464 0000000010000000110000001010000001110000010010000001100000010110000000100000000000000001000000010000000011000000010100000011010000011110000011100000100000000100010000100100000101000000100110000101100000101010000101110000110010000110000000110110000111000000111100000110100000111010000111110001000...
input:
1 496 4464 0000000010000000110000001010000001110000010010000001100000010110000000100000000000000001000000010000000011000000010100000011010000011110000011100000100000000100010000100100000101000000100110000101100000101010000101110000110010000110000000110110000111000000111100000110100000111010000111110...
output:
157 202 218 223 145 242 85 315 70 15 230 197 261 162 175 175 25 112 225 98 68 319 290 147 247 167 353 360 167 3 22 315 432 353 5 418 313 151 129 58 54 206 151 18 125 227 112 92 73 98 27 91 153 318 400 16 121 234 174 78 244 68 372 242 48 11 5 221 129 194 395 33 263 102 91 172 391 125 112 240 266 349 ...
result:
ok good job! L = 4464
Test #4:
score: 7
Accepted
time: 0ms
memory: 4176kb
input:
1 495 473 486 488 489 491 485 477 474 472 480 483 460 459 462 448 447 444 449 454 442 434 437 443 439 433 430 440 438 435 431 429 436 424 421 426 418 422 417 413 416 414 405 409 406 407 403 404 391 392 385 388 387 386 390 384 377 369 382 371 375 374 370 367 368 366 360 362 363 364 352 348 361 354 35...
output:
4455 1111010111111011101111011000000001001111011010000000110000000101111001100000000010000001011111000110000010101111001001111001110000010011111010011111000100000001101111010001111001010000001110000000000000010001110111101111010101110111111110110011110110111110110101110111001111000001111000010000011...
input:
1 495 4455 1111010111111011101111011000000001001111011010000000110000000101111001100000000010000001011111000110000010101111001001111001110000010011111010011111000100000001101111010001111001010000001110000000000000010001110111101111010101110111111110110011110110111110110101110111001111000001111000010...
output:
290 457 363 400 302 348 463 117 103 109 363 385 53 457 130 13 18 53 126 18 81 446 482 81 409 491 123 18 377 486 277 13 342 98 342 298 486 456 438 361 13 46 382 18 347 293 431 457 44 482 483 75 412 369 483 13 428 483 382 299 430 363 98 486 109 478 306 281 31 331 461 182 446 46 205 87 340 317 356 53 6...
result:
ok good job! L = 4455
Test #5:
score: 7
Accepted
time: 2ms
memory: 3904kb
input:
1 498 379 228 234 288 275 306 283 287 302 280 196 162 261 251 312 255 204 405 289 220 265 269 342 148 231 338 296 394 161 267 340 116 218 226 305 186 282 240 391 337 351 366 401 321 333 454 362 396 406 329 380 443 190 292 301 273 358 377 402 398 418 414 450 475 348 354 419 285 291 279 216 262 349 32...
output:
4482 1011101001101000011011101101111010101011010101011100001101010001011011011100000111111100001100101101111010111011111111110000011100000001011011101111100011100111001100000101101001001101001101101000100001111111101000111100101111100111011011100111101101001011110001011100011101001111011011111101101...
input:
1 498 4482 1011101001101000011011101101111010101011010101011100001101010001011011011100000111111100001100101101111010111011111111110000011100000001011011101111100011100111001100000101101001001101001101101000100001111111101000111100101111100111011011100111101101001011110001011100011101001111011011111...
output:
417 63 362 63 456 372 102 372 63 237 372 289 63 63 372 289 63 102 63 63 63 372 63 63 78 289 162 102 162 289 289 63 372 102 372 63 115 102 372 372 372 138 162 372 372 372 289 372 118 289 372 280 162 63 372 102 372 289 289 372 372 372 362 417 63 372 474 289 63 78 372 268 237 417 372 417 351 63 417 237...
result:
ok good job! L = 4482
Subtask #2:
score: 21
Accepted
Test #6:
score: 21
Accepted
time: 110ms
memory: 4460kb
input:
2 9998 941669562 945620824 923950848 951745929 487936934 545172907 544098433 249251812 620978276 575815248 584717207 588068187 353162497 679201670 592738155 438327774 762119945 576801563 408534366 592715009 525377786 603981493 -93758897 137509462 -38676966 -36724784 654920761 -595506762 -645387884 -...
output:
139972 01011111110011011100101010100101101000000010011011110110100100100001101001011001110110010101110011100101011110011001110000011101101000001000011000111110111001101111110110010101110110010111111010100110110000010001011110100000100001111011111001101111110001110010100111011010010111100110100111010...
input:
2 9998 139972 0101111111001101110010101010010110100000001001101111011010010010000110100101100111011001010111001110010101111001100111000001110110100000100001100011111011100110111111011001010111011001011111101010011011000001000101111010000010000111101111100110111111000111001010011101101001011110011010...
output:
6131 6131 359 6131 6131 6131 6131 359 6131 6131 2817 6131 359 6131 6131 5102 6131 1055 6131 7338 2817 6131 5760 5760 6131 6131 359 6131 6131 6664 6131 7884 6131 2817 7338 7338 8312 6131 6131 5102 6131 7338 6131 6131 6131 5760 6131 6131 6395 6131 6131 2817 6131 2118 8687 2471 6131 6131 6131 6131 7338...
result:
points 1.0 good job! L = 139972
Test #7:
score: 21
Accepted
time: 110ms
memory: 4456kb
input:
2 9999 731433813 672900155 -154266178 -142062752 810401507 609673796 544462551 633906986 571738102 936132990 790930862 713932885 583772218 618694605 415964624 125339983 752948390 446516496 494161410 870044586 267348103 415149513 140247028 139903914 573253228 -211705903 596809434 509194500 671221940 ...
output:
139986 01000001100110000111111101011000101001000100111100001000100011010101011000111110111000001111011001000101100010110011110001001100100101001100100011101110000011110001000110010011011110000100011110010001100011100110010011000001100100010110100011110000101100001001010000000101110101111000110001000...
input:
2 9999 139986 0100000110011000011111110101100010100100010011110000100010001101010101100011111011100000111101100100010110001011001111000100110010010100110010001110111000001111000100011001001101111000010001111001000110001110011001001100000110010001011010001111000010110000100101000000010111010111100011...
output:
4198 2380 6998 4198 4198 4198 6998 4198 4198 8541 4198 4198 4198 4198 4198 5400 4198 8286 3848 8849 4198 2037 5400 7980 2037 4198 4198 4198 4198 4198 4198 4198 7619 9045 4198 5400 4198 4198 4198 4198 2037 4198 4198 6998 4198 4198 4198 4198 4198 4198 8849 8849 7619 4198 4198 4198 4198 4198 4198 4198 ...
result:
points 1.0 good job! L = 139986
Test #8:
score: 21
Accepted
time: 178ms
memory: 4400kb
input:
2 9997 999646439 999877567 999615045 999572458 999465340 998602736 998754430 998562475 998183998 998108258 997864409 997668387 997816125 997387979 997110884 996840136 996816135 996727915 996673898 996724983 996388637 996660759 996075504 996307507 996029274 994026101 995863929 995531258 994972765 994...
output:
139958 00000000000001000000000000000000000000001000000000000011000000000001000000000000011000000000000101000000000001110000000000100000000000001001000000000010100000000000110000000000001011000000000011010000000000111000000000001111000000000100000000000001000100000000010011000000000100100000000001010...
input:
2 9997 139958 0000000000000100000000000000000000000000100000000000001100000000000100000000000001100000000000010100000000000111000000000010000000000000100100000000001010000000000011000000000000101100000000001101000000000011100000000000111100000000010000000000000100010000000001001100000000010010000000...
output:
1088 1215 5472 1158 7944 1502 3135 3011 3625 7853 396 2376 2480 2718 3625 2224 66 645 2239 4329 2871 2002 349 4713 963 1081 1075 302 384 3422 345 3651 2980 2891 1884 3288 1711 128 1812 8221 4866 980 1683 3879 1471 4534 1183 5748 5420 4153 311 4251 9426 2070 1185 2363 212 4405 3576 6882 6758 1175 312...
result:
points 1.0 good job! L = 139958
Test #9:
score: 21
Accepted
time: 148ms
memory: 4228kb
input:
2 9997 998075413 999768563 996994821 995848879 992447573 993627169 993755793 993838328 990880244 992269976 991969312 992511252 990615969 990854518 989858767 989576734 990174788 990535036 988582131 988861974 988343926 988904854 988679289 987728654 988224499 988144927 987476186 986075661 984274493 983...
output:
139958 00000000000001100111000010001001110000101110011100001100100111000010101001110000011100000000000000100111000010011001110000010110011100000110100111000000000000000000001010011100000100100110111110111001101111110110011011111111000000000000111001101111111010011011111000100111000000101001101111110...
input:
2 9997 139958 0000000000000110011100001000100111000010111001110000110010011100001010100111000001110000000000000010011100001001100111000001011001110000011010011100000000000000000000101001110000010010011011111011100110111111011001101111111100000000000011100110111111101001101111100010011100000010100110...
output:
2180 455 485 911 9955 7271 6982 9890 737 2764 9364 1214 639 1960 414 8137 7579 7130 308 8277 1409 8801 9229 1705 333 9851 2686 7725 7995 9118 3287 9917 7353 1790 26 8313 6210 7875 2347 7552 3061 2690 30 9917 3008 9054 9725 9755 6626 9214 7276 3464 9615 8305 8076 2328 599 3845 1453 9722 9074 6986 675...
result:
points 1.0 good job! L = 139958
Test #10:
score: 21
Accepted
time: 98ms
memory: 4456kb
input:
2 9996 858247159 442798730 530600104 557785258 -353636825 -522042815 -470118868 -915939541 -785438325 -68695070 108509921 10169473 -237573210 730447976 -260998254 -253035962 158696722 -91003900 600314055 292558809 168182086 279048883 463103031 504100858 320637761 399185676 413728072 629957268 280982...
output:
139944 00001110101100011100110011010000110101111100010010101111011010001100010110111110011100100011000010000011100010010111001010111101110001011000000011011101000000110110100010011001010110000011011000100000010010111110011010100001011100001111100111001100101000000011111011100110111111110100100111100...
input:
2 9996 139944 0000111010110001110011001101000011010111110001001010111101101000110001011011111001110010001100001000001110001001011100101011110111000101100000001101110100000011011010001001100101011000001101100010000001001011111001101010000101110000111110011100110010100000001111101110011011111111010010...
output:
4729 7373 2242 2242 338 940 4729 4729 8569 940 7373 7373 9560 7373 482 940 2242 7373 940 4729 3470 7373 7373 7373 6705 7373 7373 1199 4729 4783 2242 7373 7373 4729 940 940 6705 2242 4729 940 7373 7373 940 7373 7373 7373 7373 940 6705 2242 4729 2242 6705 7373 2242 4729 6705 7373 7373 940 2242 2242 73...
result:
points 1.0 good job! L = 139944
Subtask #3:
score: 0
Program floppy Time Limit Exceeded
Test #11:
score: 0
Program floppy Time Limit Exceeded
input:
3 39995 79990 922975946 766568552 929754744 983095922 988967630 879723897 928174186 951250463 831467029 836738151 464712826 467214506 167661408 156498284 426000721 530835328 -35115993 -86200136 327603078 448684869 192895652 125768327 402822176 196767853 409109378 985776352 976681898 967347754 989156...
output:
639920 10011010011000000100010111111111100100011101010100000010010010000000111000001101010000011001101001000100101001100000001000101010100101000111000010010010111011010000100010101001010000111010000001000100010111010100010010001111000000011011001010011011101100010110100111000100010010010100001000000...