QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#544566 | #7868. 天空度假山庄 | ASnown | 5 | 25ms | 3976kb | C++14 | 1.0kb | 2024-09-02 18:55:14 | 2024-09-02 18:55:15 |
Judging History
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+3);
for(;k>4;k-=4,j=num(j+4))
printf("%d %d %d %d ",j,i+1,j+2,i);
switch(k) {
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: 0ms
memory: 3976kb
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: 3792kb
input:
5166 2
output:
4 2 5 3 6 4 7 5 8 6 9 7 10 8 11 9 12 10 13 11 14 12 15 13 16 14 17 15 18 16 19 17 20 18 21 19 22 20 23 21 24 22 25 23 26 24 27 25 28 26 29 27 30 28 31 29 32 30 33 31 34 32 35 33 36 34 37 35 38 36 39 37 40 38 41 39 42 40 43 41 44 42 45 43 46 44 47 45 48 46 49 47 50 48 51 49 52 50 53 51 54 52 55 53 56...
result:
ok correct
Test #3:
score: 5
Accepted
time: 0ms
memory: 3848kb
input:
7445 2
output:
4 2 5 3 6 4 7 5 8 6 9 7 10 8 11 9 12 10 13 11 14 12 15 13 16 14 17 15 18 16 19 17 20 18 21 19 22 20 23 21 24 22 25 23 26 24 27 25 28 26 29 27 30 28 31 29 32 30 33 31 34 32 35 33 36 34 37 35 38 36 39 37 40 38 41 39 42 40 43 41 44 42 45 43 46 44 47 45 48 46 49 47 50 48 51 49 52 50 53 51 54 52 55 53 56...
result:
ok correct
Test #4:
score: 5
Accepted
time: 1ms
memory: 3972kb
input:
1295 2
output:
4 2 5 3 6 4 7 5 8 6 9 7 10 8 11 9 12 10 13 11 14 12 15 13 16 14 17 15 18 16 19 17 20 18 21 19 22 20 23 21 24 22 25 23 26 24 27 25 28 26 29 27 30 28 31 29 32 30 33 31 34 32 35 33 36 34 37 35 38 36 39 37 40 38 41 39 42 40 43 41 44 42 45 43 46 44 47 45 48 46 49 47 50 48 51 49 52 50 53 51 54 52 55 53 56...
result:
ok correct
Subtask #2:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 25ms
memory: 3852kb
input:
86132 9
output:
4 2 6 1 8 2 10 1 2 5 3 7 2 9 3 11 2 3 6 4 8 3 10 4 12 3 4 7 5 9 4 11 5 13 4 5 8 6 10 5 12 6 14 5 6 9 7 11 6 13 7 15 6 7 10 8 12 7 14 8 16 7 8 11 9 13 8 15 9 17 8 9 12 10 14 9 16 10 18 9 10 13 11 15 10 17 11 19 10 11 14 12 16 11 18 12 20 11 12 15 13 17 12 19 13 21 12 13 16 14 18 13 20 14 22 13 14 17 ...
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: 13ms
memory: 3904kb
input:
1777 229
output:
4 2 6 1 8 2 10 1 12 2 14 1 16 2 18 1 20 2 22 1 24 2 26 1 28 2 30 1 32 2 34 1 36 2 38 1 40 2 42 1 44 2 46 1 48 2 50 1 52 2 54 1 56 2 58 1 60 2 62 1 64 2 66 1 68 2 70 1 72 2 74 1 76 2 78 1 80 2 82 1 84 2 86 1 88 2 90 1 92 2 94 1 96 2 98 1 100 2 102 1 104 2 106 1 108 2 110 1 112 2 114 1 116 2 118 1 120...
result:
wrong answer Integer 1778 violates the range [1, 1777]
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #3:
0%