QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#527564#7868. 天空度假山庄asupersalmon0 43ms4116kbC++141.3kb2024-08-22 17:02:252024-08-22 17:02:25

Judging History

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

  • [2024-08-22 17:02:25]
  • 评测
  • 测评结果:0
  • 用时:43ms
  • 内存:4116kb
  • [2024-08-22 17:02:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int N;
int K;

int main(){
    scanf(" %d",&N);
    scanf(" %d",&K);

    int num = (N-1)/2;
    long long int sum = 0;

    vector<int> v;
    vector<int> ans;

    for(int i = 1; i <= K; i++){
        v.push_back(i);
        sum += i;
    }

    sum %= N;

    if(sum == 0){
        ans.push_back(v.back() + 1);
        v.pop_back();
        while(!v.empty()){
            ans.push_back(v.back());
            v.pop_back();
        }
    }
    else if(sum == 1){
        while(!v.empty()){
            ans.push_back(v.back());
            v.pop_back();
        }
    }
    else{
        int fum = N + 1 - sum;

        for(int i = K; i >= 1; i--,num--){
            if(fum <= num - i){
                v.pop_back();
                ans.push_back(fum + i);
            }
            else{
                fum -= (num - i);
                ans.push_back(num);
                v.pop_back();
            }
        }

        while(!v.empty()){
            ans.push_back(v.back());
            v.pop_back();
        }
    }

    int p = 1;

    for(int i = 1; i < N; i++){
        for(int j = 0; j < K; j++){
            p = (p + ans[j] - 1) % N + 1;
            printf("%d ",p);
        }
    }

}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 1ms
memory: 3880kb

input:

8216 1

output:

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 102 10...

result:

ok correct

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 4108kb

input:

5166 2

output:

2583 5164 2580 5161 2577 5158 2574 5155 2571 5152 2568 5149 2565 5146 2562 5143 2559 5140 2556 5137 2553 5134 2550 5131 2547 5128 2544 5125 2541 5122 2538 5119 2535 5116 2532 5113 2529 5110 2526 5107 2523 5104 2520 5101 2517 5098 2514 5095 2511 5092 2508 5089 2505 5086 2502 5083 2499 5080 2496 5077 ...

result:

wrong answer visit same point several times.

Subtask #2:

score: 0
Wrong Answer

Test #5:

score: 20
Accepted
time: 37ms
memory: 3784kb

input:

86132 9

output:

43066 86106 43013 86051 42956 85992 42895 85929 42830 85895 42803 85842 42748 85785 42689 85724 42626 85659 42592 85632 42539 85577 42482 85518 42421 85455 42356 85421 42329 85368 42274 85311 42215 85250 42152 85185 42118 85158 42065 85103 42008 85044 41947 84981 41882 84947 41855 84894 41800 84837 ...

result:

ok correct

Test #6:

score: 0
Wrong Answer
time: 38ms
memory: 3824kb

input:

73452 11

output:

36726 73409 36639 73320 36548 73227 36453 73130 36354 73029 36251 72976 36207 72889 36118 72798 36025 72703 35928 72604 35827 72501 35774 72457 35687 72368 35596 72275 35501 72178 35402 72077 35299 72024 35255 71937 35166 71846 35073 71751 34976 71652 34875 71549 34822 71505 34735 71416 34644 71323 ...

result:

wrong answer visit same point several times.

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #16:

score: 20
Accepted
time: 19ms
memory: 4112kb

input:

1777 229

output:

551 1100 1648 418 964 1509 276 819 1361 125 665 1204 1742 502 1038 1573 330 863 1395 149 679 1208 1736 486 1012 1537 284 807 1329 73 593 1112 1630 370 886 1401 138 651 1163 1674 407 916 1424 154 660 1165 1669 395 897 1398 121 620 1118 1615 334 829 1323 39 531 1022 1512 224 712 1199 1685 393 877 1360...

result:

ok correct

Test #17:

score: 20
Accepted
time: 8ms
memory: 3896kb

input:

1129 229

output:

565 1128 318 636 953 140 455 769 1082 265 576 886 66 374 681 987 163 467 770 1072 244 544 843 12 309 605 900 65 358 650 941 102 391 679 966 123 408 692 975 128 409 689 968 117 394 670 945 90 363 635 906 47 316 584 851 1117 253 517 780 1042 174 434 693 951 79 335 590 844 1097 220 471 721 970 89 336 5...

result:

ok correct

Test #18:

score: 20
Accepted
time: 43ms
memory: 4116kb

input:

4253 233

output:

2127 2977 3826 421 1268 2114 2959 3803 393 1235 2076 2916 3755 340 1177 2013 2848 3682 262 1094 1925 2755 3584 159 986 1812 2637 3461 31 853 1674 2494 3313 4131 695 1511 2326 3140 3953 512 1323 2133 2942 3750 304 1110 1915 2719 3522 71 872 1672 2471 3269 4066 609 1404 2198 2991 3783 321 1111 1900 26...

result:

ok correct

Test #19:

score: 20
Accepted
time: 21ms
memory: 3848kb

input:

2311 233

output:

706 1410 2113 504 1205 1905 293 991 1688 73 768 1462 2155 536 1227 1917 295 983 1670 45 730 1414 2097 468 1149 1829 197 875 1552 2228 592 1266 1939 300 971 1641 2310 667 1334 2000 354 1018 1681 32 693 1353 2012 359 1016 1672 16 670 1323 1975 315 965 1614 2262 598 1244 1889 222 865 1507 2148 477 1116...

result:

ok correct

Test #20:

score: 20
Accepted
time: 35ms
memory: 3820kb

input:

6712 114

output:

273 544 814 1083 1351 1618 1884 2149 2413 2676 2938 3199 3459 3718 3976 4233 4489 4744 4998 5251 5503 5754 6004 6253 6501 36 282 527 771 1014 1256 1497 1737 1976 2214 2451 2687 2922 3156 3389 3621 3852 4082 4311 4539 4766 4992 5217 5441 5664 5886 6107 6327 6546 52 269 485 700 914 1127 1339 1550 1760...

result:

ok correct

Test #21:

score: 0
Wrong Answer
time: 6ms
memory: 3772kb

input:

1050 114

output:

525 1024 472 969 415 910 354 847 289 780 220 709 147 634 70 555 1039 472 954 385 865 294 772 199 675 100 574 1047 469 940 360 829 247 714 130 595 9 472 934 345 805 214 672 79 535 990 394 847 249 700 100 549 997 394 840 235 679 72 514 955 345 784 172 609 1045 430 864 247 679 60 490 919 297 724 100 52...

result:

wrong answer visit same point several times.

Subtask #5:

score: 0
Skipped

Dependency #1:

0%