QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#544550#7868. 天空度假山庄ASnown5 29ms3876kbC++141.0kb2024-09-02 18:50:452024-09-02 18:50:46

Judging History

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

  • [2024-09-02 18:50:46]
  • 评测
  • 测评结果:5
  • 用时:29ms
  • 内存:3876kb
  • [2024-09-02 18:50:45]
  • 提交

answer

#include<bits/stdc++.h>
#define file(F) freopen(#F".in","r",stdin),freopen(#F".out","w",stdout)
#define lowbit(x) ((x)&-(x))
#define ALL(x) x.begin(),x.end()
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
using ll=long long;
template<typename T>
inline bool Max(T &x,T y) { return std::less<T>()(x,y)&&(x=y,true); }
template<typename T>
inline bool Min(T &x,T y) { return std::less<T>()(y,x)&&(x=y,true); }
void Solve();
int n,m;
inline int num(int x) { return (x-1)%n+1; }
signed main() {
#ifndef ONLINE_JUDGE
#endif
   cin.tie(nullptr)->sync_with_stdio(false);
   Solve();
}
void Solve() {
   cin>>n>>m;
   for(int i=1;i<n;i++) {
      int k=m,j=num(i+4);
      for(;k>4;k-=4,j=num(j+4))
         printf("%d %d %d %d ",j,i+1,j+2,i);
      switch(k%4) {
      case 1: printf("%d ",i+1); break;
      case 2: printf("%d %d ",j,i+1); break;
      case 3: printf("%d %d %d ",j,num(j+2),i+1); break;
      case 4: printf("%d %d %d %d ",j,num(j+2),i,i+1); break;
      }
   }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

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

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: 5
Accepted
time: 1ms
memory: 3796kb

input:

5166 2

output:

5 2 6 3 7 4 8 5 9 6 10 7 11 8 12 9 13 10 14 11 15 12 16 13 17 14 18 15 19 16 20 17 21 18 22 19 23 20 24 21 25 22 26 23 27 24 28 25 29 26 30 27 31 28 32 29 33 30 34 31 35 32 36 33 37 34 38 35 39 36 40 37 41 38 42 39 43 40 44 41 45 42 46 43 47 44 48 45 49 46 50 47 51 48 52 49 53 50 54 51 55 52 56 53 5...

result:

ok correct

Test #3:

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

input:

7445 2

output:

5 2 6 3 7 4 8 5 9 6 10 7 11 8 12 9 13 10 14 11 15 12 16 13 17 14 18 15 19 16 20 17 21 18 22 19 23 20 24 21 25 22 26 23 27 24 28 25 29 26 30 27 31 28 32 29 33 30 34 31 35 32 36 33 37 34 38 35 39 36 40 37 41 38 42 39 43 40 44 41 45 42 46 43 47 44 48 45 49 46 50 47 51 48 52 49 53 50 54 51 55 52 56 53 5...

result:

ok correct

Test #4:

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

input:

1295 2

output:

5 2 6 3 7 4 8 5 9 6 10 7 11 8 12 9 13 10 14 11 15 12 16 13 17 14 18 15 19 16 20 17 21 18 22 19 23 20 24 21 25 22 26 23 27 24 28 25 29 26 30 27 31 28 32 29 33 30 34 31 35 32 36 33 37 34 38 35 39 36 40 37 41 38 42 39 43 40 44 41 45 42 46 43 47 44 48 45 49 46 50 47 51 48 52 49 53 50 54 51 55 52 56 53 5...

result:

ok correct

Subtask #2:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 29ms
memory: 3876kb

input:

86132 9

output:

5 2 7 1 9 2 11 1 2 6 3 8 2 10 3 12 2 3 7 4 9 3 11 4 13 3 4 8 5 10 4 12 5 14 4 5 9 6 11 5 13 6 15 5 6 10 7 12 6 14 7 16 6 7 11 8 13 7 15 8 17 7 8 12 9 14 8 16 9 18 8 9 13 10 15 9 17 10 19 9 10 14 11 16 10 18 11 20 10 11 15 12 17 11 19 12 21 11 12 16 13 18 12 20 13 22 12 13 17 14 19 13 21 14 23 13 14 ...

result:

wrong answer Integer 86133 violates the range [1, 86132]

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #16:

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

input:

1777 229

output:

5 2 7 1 9 2 11 1 13 2 15 1 17 2 19 1 21 2 23 1 25 2 27 1 29 2 31 1 33 2 35 1 37 2 39 1 41 2 43 1 45 2 47 1 49 2 51 1 53 2 55 1 57 2 59 1 61 2 63 1 65 2 67 1 69 2 71 1 73 2 75 1 77 2 79 1 81 2 83 1 85 2 87 1 89 2 91 1 93 2 95 1 97 2 99 1 101 2 103 1 105 2 107 1 109 2 111 1 113 2 115 1 117 2 119 1 121...

result:

wrong answer Integer 1778 violates the range [1, 1777]

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #3:

0%