QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#254149 | #7526. Credit Cards | MikhailovBair# | AC ✓ | 53ms | 15764kb | C++17 | 1.9kb | 2023-11-18 02:04:43 | 2023-11-18 02:04:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
using namespace std;
signed main() {
int n;
cin >> n;
int a = 1;
vector<int> a1, a2, a3;
while ((n / 4) != 0) {
if (n == 4 or n == 5 or n == 6) {
a1.push_back(2);
a2.push_back(3);
a3.push_back(4);
n = 0;
}
else if (n == 7) {
a1.push_back(3);
a2.push_back(6);
a3.push_back(7);
a1.push_back(2);
a2.push_back(4);
a3.push_back(5);
n = 0;
}
else if (n == 8 or n == 9) {
a1.push_back(3);
a2.push_back(4);
a3.push_back(6);
a1.push_back(2);
a2.push_back(7);
a3.push_back(8);
n = 0;
}
else if (n == 10 or n == 11 or n == 12) {
a1.push_back(3);
a2.push_back(4);
a3.push_back(6);
a1.push_back(5);
a2.push_back(7);
a3.push_back(10);
a1.push_back(2);
a2.push_back(8);
a3.push_back(9);
n = 0;
}
else if (n == 15) {
n = 14;
}
else {
a = n / 4;
//cout << 'D' << a << '\n';
for (int i = 2 * a + n % 4; i > (a + (n % 4)); i--) {
//cout << i << " " << i + a << i + 2 * a << '\n';
a1.push_back(i);
a2.push_back(i + a);
a3.push_back(i + 2 * a);
}
n = a + (n % 4);
}
}
reverse(a1.begin(), a1.end());
reverse(a2.begin(), a2.end());
reverse(a3.begin(), a3.end());
n = a1.size();
cout << n << "\n";
for (int i = 0; i < n; ++i)
cout << a1[i] << " " << a2[i] << " " << a3[i] << "\n";
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
3
output:
0
result:
ok OK 0 triangles!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3464kb
input:
4
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
9
output:
2 2 7 8 3 4 6
result:
ok OK 2 triangles!
Test #4:
score: 0
Accepted
time: 53ms
memory: 13444kb
input:
1000000
output:
333333 2 3 4 5 9 13 6 10 14 7 11 15 8 12 16 17 33 49 18 34 50 19 35 51 20 36 52 21 37 53 22 38 54 23 39 55 24 40 56 25 41 57 26 42 58 27 43 59 28 44 60 29 45 61 30 46 62 31 47 63 32 48 64 65 126 187 66 127 188 67 128 189 68 129 190 69 130 191 70 131 192 71 132 193 72 133 194 73 134 195 74 135 196 75...
result:
ok OK 333333 triangles!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
1
output:
0
result:
ok OK 0 triangles!
Test #6:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
2
output:
0
result:
ok OK 0 triangles!
Test #7:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
5
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
6
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
7
output:
2 2 4 5 3 6 7
result:
ok OK 2 triangles!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
8
output:
2 2 7 8 3 4 6
result:
ok OK 2 triangles!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
10
output:
3 2 8 9 5 7 10 3 4 6
result:
ok OK 3 triangles!
Test #12:
score: 0
Accepted
time: 31ms
memory: 7988kb
input:
621316
output:
207105 2 8 9 5 7 10 3 4 6 11 21 31 12 22 32 13 23 33 14 24 34 15 25 35 16 26 36 17 27 37 18 28 38 19 29 39 20 30 40 41 79 117 42 80 118 43 81 119 44 82 120 45 83 121 46 84 122 47 85 123 48 86 124 49 87 125 50 88 126 51 89 127 52 90 128 53 91 129 54 92 130 55 93 131 56 94 132 57 95 133 58 96 134 59 9...
result:
ok OK 207105 triangles!
Test #13:
score: 0
Accepted
time: 36ms
memory: 8920kb
input:
713171
output:
237723 2 8 9 5 7 10 3 4 6 12 23 34 13 24 35 14 25 36 15 26 37 16 27 38 17 28 39 18 29 40 19 30 41 20 31 42 21 32 43 22 33 44 45 89 133 46 90 134 47 91 135 48 92 136 49 93 137 50 94 138 51 95 139 52 96 140 53 97 141 54 98 142 55 99 143 56 100 144 57 101 145 58 102 146 59 103 147 60 104 148 61 105 149...
result:
ok OK 237723 triangles!
Test #14:
score: 0
Accepted
time: 40ms
memory: 15764kb
input:
825609
output:
275202 2 3 4 6 9 12 7 10 13 8 11 14 16 28 40 17 29 41 18 30 42 19 31 43 20 32 44 21 33 45 22 34 46 23 35 47 24 36 48 25 37 49 26 38 50 27 39 51 52 103 154 53 104 155 54 105 156 55 106 157 56 107 158 57 108 159 58 109 160 59 110 161 60 111 162 61 112 163 62 113 164 63 114 165 64 115 166 65 116 167 66...
result:
ok OK 275202 triangles!
Test #15:
score: 0
Accepted
time: 39ms
memory: 9436kb
input:
782282
output:
260760 2 3 4 6 9 12 7 10 13 8 11 14 15 27 39 16 28 40 17 29 41 18 30 42 19 31 43 20 32 44 21 33 45 22 34 46 23 35 47 24 36 48 25 37 49 26 38 50 51 98 145 52 99 146 53 100 147 54 101 148 55 102 149 56 103 150 57 104 151 58 105 152 59 106 153 60 107 154 61 108 155 62 109 156 63 110 157 64 111 158 65 1...
result:
ok OK 260760 triangles!
Test #16:
score: 0
Accepted
time: 8ms
memory: 4344kb
input:
148128
output:
49375 2 8 9 5 7 10 3 4 6 13 22 31 14 23 32 15 24 33 16 25 34 17 26 35 18 27 36 19 28 37 20 29 38 21 30 39 40 76 112 41 77 113 42 78 114 43 79 115 44 80 116 45 81 117 46 82 118 47 83 119 48 84 120 49 85 121 50 86 122 51 87 123 52 88 124 53 89 125 54 90 126 55 91 127 56 92 128 57 93 129 58 94 130 59 9...
result:
ok OK 49375 triangles!
Test #17:
score: 0
Accepted
time: 36ms
memory: 8496kb
input:
681282
output:
227093 2 8 9 5 7 10 3 4 6 13 23 33 14 24 34 15 25 35 16 26 36 17 27 37 18 28 38 19 29 39 20 30 40 21 31 41 22 32 42 43 85 127 44 86 128 45 87 129 46 88 130 47 89 131 48 90 132 49 91 133 50 92 134 51 93 135 52 94 136 53 95 137 54 96 138 55 97 139 56 98 140 57 99 141 58 100 142 59 101 143 60 102 144 6...
result:
ok OK 227093 triangles!
Test #18:
score: 0
Accepted
time: 42ms
memory: 13364kb
input:
798547
output:
266182 2 3 4 5 8 11 6 9 12 7 10 13 14 26 38 15 27 39 16 28 40 17 29 41 18 30 42 19 31 43 20 32 44 21 33 45 22 34 46 23 35 47 24 36 48 25 37 49 50 99 148 51 100 149 52 101 150 53 102 151 54 103 152 55 104 153 56 105 154 57 106 155 58 107 156 59 108 157 60 109 158 61 110 159 62 111 160 63 112 161 64 1...
result:
ok OK 266182 triangles!
Test #19:
score: 0
Accepted
time: 11ms
memory: 5908kb
input:
349290
output:
116429 2 3 4 7 13 19 8 14 20 9 15 21 10 16 22 11 17 23 12 18 24 25 46 67 26 47 68 27 48 69 28 49 70 29 50 71 30 51 72 31 52 73 32 53 74 33 54 75 34 55 76 35 56 77 36 57 78 37 58 79 38 59 80 39 60 81 40 61 82 41 62 83 42 63 84 43 64 85 44 65 86 45 66 87 88 173 258 89 174 259 90 175 260 91 176 261 92 ...
result:
ok OK 116429 triangles!
Test #20:
score: 0
Accepted
time: 14ms
memory: 5732kb
input:
317275
output:
105758 2 4 5 3 6 7 8 13 18 9 14 19 10 15 20 11 16 21 12 17 22 23 42 61 24 43 62 25 44 63 26 45 64 27 46 65 28 47 66 29 48 67 30 49 68 31 50 69 32 51 70 33 52 71 34 53 72 35 54 73 36 55 74 37 56 75 38 57 76 39 58 77 40 59 78 41 60 79 80 157 234 81 158 235 82 159 236 83 160 237 84 161 238 85 162 239 8...
result:
ok OK 105758 triangles!
Test #21:
score: 0
Accepted
time: 6ms
memory: 4428kb
input:
100000
output:
33333 2 4 5 3 6 7 8 14 20 9 15 21 10 16 22 11 17 23 12 18 24 13 19 25 26 51 76 27 52 77 28 53 78 29 54 79 30 55 80 31 56 81 32 57 82 33 58 83 34 59 84 35 60 85 36 61 86 37 62 87 38 63 88 39 64 89 40 65 90 41 66 91 42 67 92 43 68 93 44 69 94 45 70 95 46 71 96 47 72 97 48 73 98 49 74 99 50 75 100 101 ...
result:
ok OK 33333 triangles!
Test #22:
score: 0
Accepted
time: 5ms
memory: 4112kb
input:
83568
output:
27855 2 3 4 7 12 17 8 13 18 9 14 19 10 15 20 11 16 21 22 43 64 23 44 65 24 45 66 25 46 67 26 47 68 27 48 69 28 49 70 29 50 71 30 51 72 31 52 73 32 53 74 33 54 75 34 55 76 35 56 77 36 57 78 37 58 79 38 59 80 39 60 81 40 61 82 41 62 83 42 63 84 85 166 247 86 167 248 87 168 249 88 169 250 89 170 251 90...
result:
ok OK 27855 triangles!
Test #23:
score: 0
Accepted
time: 2ms
memory: 3736kb
input:
41476
output:
13825 2 3 4 5 8 11 6 9 12 7 10 13 14 24 34 15 25 35 16 26 36 17 27 37 18 28 38 19 29 39 20 30 40 21 31 41 22 32 42 23 33 43 44 84 124 45 85 125 46 86 126 47 87 127 48 88 128 49 89 129 50 90 130 51 91 131 52 92 132 53 93 133 54 94 134 55 95 135 56 96 136 57 97 137 58 98 138 59 99 139 60 100 140 61 10...
result:
ok OK 13825 triangles!
Test #24:
score: 0
Accepted
time: 4ms
memory: 3980kb
input:
61028
output:
20342 2 3 4 6 10 14 7 11 15 8 12 16 9 13 17 18 33 48 19 34 49 20 35 50 21 36 51 22 37 52 23 38 53 24 39 54 25 40 55 26 41 56 27 42 57 28 43 58 29 44 59 30 45 60 31 46 61 32 47 62 63 122 181 64 123 182 65 124 183 66 125 184 67 126 185 68 127 186 69 128 187 70 129 188 71 130 189 72 131 190 73 132 191 ...
result:
ok OK 20342 triangles!
Test #25:
score: 0
Accepted
time: 2ms
memory: 3864kb
input:
34231
output:
11410 2 8 9 5 7 10 3 4 6 11 19 27 12 20 28 13 21 29 14 22 30 15 23 31 16 24 32 17 25 33 18 26 34 35 69 103 36 70 104 37 71 105 38 72 106 39 73 107 40 74 108 41 75 109 42 76 110 43 77 111 44 78 112 45 79 113 46 80 114 47 81 115 48 82 116 49 83 117 50 84 118 51 85 119 52 86 120 53 87 121 54 88 122 55 ...
result:
ok OK 11410 triangles!
Test #26:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
10000
output:
3333 2 8 9 5 7 10 3 4 6 11 21 31 12 22 32 13 23 33 14 24 34 15 25 35 16 26 36 17 27 37 18 28 38 19 29 39 20 30 40 41 80 119 42 81 120 43 82 121 44 83 122 45 84 123 46 85 124 47 86 125 48 87 126 49 88 127 50 89 128 51 90 129 52 91 130 53 92 131 54 93 132 55 94 133 56 95 134 57 96 135 58 97 136 59 98 ...
result:
ok OK 3333 triangles!
Test #27:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
8370
output:
2789 2 7 8 3 4 6 10 18 26 11 19 27 12 20 28 13 21 29 14 22 30 15 23 31 16 24 32 17 25 33 34 67 100 35 68 101 36 69 102 37 70 103 38 71 104 39 72 105 40 73 106 41 74 107 42 75 108 43 76 109 44 77 110 45 78 111 46 79 112 47 80 113 48 81 114 49 82 115 50 83 116 51 84 117 52 85 118 53 86 119 54 87 120 5...
result:
ok OK 2789 triangles!
Test #28:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
5858
output:
1952 2 7 8 3 4 6 9 14 19 10 15 20 11 16 21 12 17 22 13 18 23 24 47 70 25 48 71 26 49 72 27 50 73 28 51 74 29 52 75 30 53 76 31 54 77 32 55 78 33 56 79 34 57 80 35 58 81 36 59 82 37 60 83 38 61 84 39 62 85 40 63 86 41 64 87 42 65 88 43 66 89 44 67 90 45 68 91 46 69 92 93 185 277 94 186 278 95 187 279...
result:
ok OK 1952 triangles!
Test #29:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
688
output:
229 2 3 4 5 8 11 6 9 12 7 10 13 14 24 34 15 25 35 16 26 36 17 27 37 18 28 38 19 29 39 20 30 40 21 31 41 22 32 42 23 33 43 44 87 130 45 88 131 46 89 132 47 90 133 48 91 134 49 92 135 50 93 136 51 94 137 52 95 138 53 96 139 54 97 140 55 98 141 56 99 142 57 100 143 58 101 144 59 102 145 60 103 146 61 1...
result:
ok OK 229 triangles!
Test #30:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
6480
output:
2159 2 7 8 3 4 6 10 16 22 11 17 23 12 18 24 13 19 25 14 20 26 15 21 27 28 53 78 29 54 79 30 55 80 31 56 81 32 57 82 33 58 83 34 59 84 35 60 85 36 61 86 37 62 87 38 63 88 39 64 89 40 65 90 41 66 91 42 67 92 43 68 93 44 69 94 45 70 95 46 71 96 47 72 97 48 73 98 49 74 99 50 75 100 51 76 101 52 77 102 1...
result:
ok OK 2159 triangles!
Test #31:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
1000
output:
333 2 3 4 5 9 13 6 10 14 7 11 15 8 12 16 17 33 49 18 34 50 19 35 51 20 36 52 21 37 53 22 38 54 23 39 55 24 40 56 25 41 57 26 42 58 27 43 59 28 44 60 29 45 61 30 46 62 31 47 63 32 48 64 65 127 189 66 128 190 67 129 191 68 130 192 69 131 193 70 132 194 71 133 195 72 134 196 73 135 197 74 136 198 75 13...
result:
ok OK 333 triangles!
Test #32:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
491
output:
163 2 7 8 3 4 6 9 17 25 10 18 26 11 19 27 12 20 28 13 21 29 14 22 30 15 23 31 16 24 32 33 64 95 34 65 96 35 66 97 36 67 98 37 68 99 38 69 100 39 70 101 40 71 102 41 72 103 42 73 104 43 74 105 44 75 106 45 76 107 46 77 108 47 78 109 48 79 110 49 80 111 50 81 112 51 82 113 52 83 114 53 84 115 54 85 11...
result:
ok OK 163 triangles!
Test #33:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
667
output:
222 2 3 4 5 8 11 6 9 12 7 10 13 14 24 34 15 25 35 16 26 36 17 27 37 18 28 38 19 29 39 20 30 40 21 31 41 22 32 42 23 33 43 44 86 128 45 87 129 46 88 130 47 89 131 48 90 132 49 91 133 50 92 134 51 93 135 52 94 136 53 95 137 54 96 138 55 97 139 56 98 140 57 99 141 58 100 142 59 101 143 60 102 144 61 10...
result:
ok OK 222 triangles!
Test #34:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
63
output:
20 2 3 4 7 11 15 8 12 16 9 13 17 10 14 18 19 34 49 20 35 50 21 36 51 22 37 52 23 38 53 24 39 54 25 40 55 26 41 56 27 42 57 28 43 58 29 44 59 30 45 60 31 46 61 32 47 62 33 48 63
result:
ok OK 20 triangles!
Test #35:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
682
output:
227 2 3 4 5 8 11 6 9 12 7 10 13 14 24 34 15 25 35 16 26 36 17 27 37 18 28 38 19 29 39 20 30 40 21 31 41 22 32 42 23 33 43 44 87 130 45 88 131 46 89 132 47 90 133 48 91 134 49 92 135 50 93 136 51 94 137 52 95 138 53 96 139 54 97 140 55 98 141 56 99 142 57 100 143 58 101 144 59 102 145 60 103 146 61 1...
result:
ok OK 227 triangles!
Test #36:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
100
output:
33 2 4 5 3 6 7 8 14 20 9 15 21 10 16 22 11 17 23 12 18 24 13 19 25 26 51 76 27 52 77 28 53 78 29 54 79 30 55 80 31 56 81 32 57 82 33 58 83 34 59 84 35 60 85 36 61 86 37 62 87 38 63 88 39 64 89 40 65 90 41 66 91 42 67 92 43 68 93 44 69 94 45 70 95 46 71 96 47 72 97 48 73 98 49 74 99 50 75 100
result:
ok OK 33 triangles!
Test #37:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
38
output:
12 2 8 9 5 7 10 3 4 6 12 21 30 13 22 31 14 23 32 15 24 33 16 25 34 17 26 35 18 27 36 19 28 37 20 29 38
result:
ok OK 12 triangles!
Test #38:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
167
output:
55 2 8 9 5 7 10 3 4 6 12 23 34 13 24 35 14 25 36 15 26 37 16 27 38 17 28 39 18 29 40 19 30 41 20 31 42 21 32 43 22 33 44 45 86 127 46 87 128 47 88 129 48 89 130 49 90 131 50 91 132 51 92 133 52 93 134 53 94 135 54 95 136 55 96 137 56 97 138 57 98 139 58 99 140 59 100 141 60 101 142 61 102 143 62 103...
result:
ok OK 55 triangles!
Test #39:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
34
output:
11 2 8 9 5 7 10 3 4 6 11 19 27 12 20 28 13 21 29 14 22 30 15 23 31 16 24 32 17 25 33 18 26 34
result:
ok OK 11 triangles!