QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#723687 | #4663. Arithmetics Game | Ducanh2002# | WA | 1ms | 3796kb | C++20 | 1.2kb | 2024-11-07 23:41:23 | 2024-11-07 23:41:24 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
template<class... T> void debug(T&&... t){ int x = sizeof...(t); ((cout << t << (--x ? ", " : "]\n")), ...); }
#if ONLINE_JUDGE
#define default_file() 88
#else
#define default_file() freopen("C:\\Users\\DUC ANH\\Downloads\\Gen\\default\\input.in", "r", stdin); freopen("C:\\Users\\DUC ANH\\Downloads\\Gen\\default\\output.out", "w", stdout);
#define dbg(...) cout << "LINE(" << __LINE__ << ") : [" << #__VA_ARGS__ << "] = [", debug(__VA_ARGS__)
#endif
#define FOR(i, a, b) for(int i = (a); i <= (b); ++(i))
#define all(x) x.begin(), x.end()
void solve(){
int n; cin >> n;
vector<int> val(n << 1 | 1);
vector<bool> mark(val.size());
for(int i = 1; i <= n; ++i) {
val[i] = i*2-1; val[i + n] = i*2;
}
int ptr = int(val.size()) - 2;
for(int i = 1; i <= n - 1; ++i){
int x; cin >> x;
mark[x] = true;
while(mark[val[ptr]]) ptr--;
mark[val[ptr]] = true;
cout << val[ptr--] << "\n";
fflush(stdout);
}
}
signed main(){
// ios::sync_with_stdio(false); cin.tie(0); //srand(time(NULL));
default_file();
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3516kb
input:
2 2
output:
3
result:
ok gcd(1, 4) = 1
Test #2:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
5 2 5 4 3
output:
8 6 9 7
result:
ok gcd(1, 10) = 1
Test #3:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
7 9 6 8 2 11 3
output:
12 10 4 13 7 5
result:
ok gcd(1, 14) = 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
8 9 16 4 2 15 13 5
output:
14 12 10 8 6 11 7
result:
ok gcd(1, 3) = 1
Test #5:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
9 4 9 6 8 13 15 3 18
output:
16 14 12 10 2 17 11 7
result:
ok gcd(1, 5) = 1
Test #6:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
10 17 14 6 11 8 2 15 7 1
output:
18 16 12 10 4 19 13 9 5
result:
ok gcd(3, 20) = 1
Test #7:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
59 95 89 24 32 7 84 73 111 69 13 11 57 66 54 3 10 38 33 35 17 22 34 60 91 16 50 48 14 107 117 97 42 30 15 39 27 99 109 118 93 77 105 115 61 87 65 43 25 59 23 37 41 21 19 51 47 9 31
output:
116 114 112 110 108 106 104 102 100 98 96 94 92 90 88 86 82 80 78 76 74 72 70 68 64 62 58 56 52 46 44 40 36 28 26 20 18 12 8 6 4 2 113 103 101 85 83 81 79 75 71 67 63 55 53 49 45 29
result:
ok gcd(1, 5) = 1
Test #8:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
66 63 98 124 106 101 65 88 73 44 64 78 17 6 24 92 113 132 21 45 13 111 119 32 81 11 28 50 87 91 43 35 47 10 23 22 41 27 4 12 29 14 123 95 129 55 79 39 3 77 49 61 67 83 37 31 103 57 93 5 53 71 9 19 15 33
output:
130 128 126 122 120 118 116 114 112 110 108 104 102 100 96 94 90 86 84 82 80 76 74 72 70 68 66 62 60 58 56 54 52 48 46 42 40 38 36 34 30 26 20 18 16 8 2 131 127 125 121 117 115 109 107 105 99 97 89 85 75 69 59 51 25
result:
ok gcd(1, 7) = 1
Test #9:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
73 22 43 138 60 79 77 14 83 50 109 11 120 44 107 7 55 52 4 24 100 36 71 133 59 97 145 137 135 16 146 42 8 101 20 103 6 73 18 19 21 26 53 115 30 10 57 139 29 127 37 105 63 13 129 125 3 17 5 39 49 69 31 93 35 27 25 33 9 61 47 51 15
output:
144 142 140 136 134 132 130 128 126 124 122 118 116 114 112 110 108 106 104 102 98 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68 66 64 62 58 56 54 48 46 40 38 34 32 28 12 2 143 141 131 123 121 119 117 113 111 99 95 91 89 87 85 81 75 67 65 45 41
result:
ok gcd(1, 23) = 1
Test #10:
score: 0
Accepted
time: 1ms
memory: 3604kb
input:
80 101 47 151 48 72 139 111 2 16 40 58 56 17 60 39 41 121 43 96 147 114 94 125 79 64 10 52 4 87 85 24 8 65 7 53 69 135 89 54 99 91 31 38 137 143 107 18 6 117 73 97 25 95 5 12 29 71 37 103 55 57 123 61 51 115 105 127 13 35 1 27 19 21 33 160 63 59 45 9
output:
158 156 154 152 150 148 146 144 142 140 138 136 134 132 130 128 126 124 122 120 118 116 112 110 108 106 104 102 100 98 92 90 88 86 84 82 80 78 76 74 70 68 66 62 50 46 44 42 36 34 32 30 28 26 22 20 14 159 157 155 153 149 145 141 133 131 129 119 113 109 93 83 81 77 75 67 49 23 15
result:
ok gcd(3, 11) = 1
Test #11:
score: -100
Wrong Answer
time: 1ms
memory: 3796kb
input:
87 174 88 30 69 132 64 1 45 139 152 171 33 134 36 153 42 31 56 130 163 54 72 159 27 103 107 81 39 91 73 19 105 8 82 50 92 141 20 3 143 117 95 83 7 137 12 151 22 133 71 167 4 29 87 49 6 47 79 127 2 23 111 121 123 37 53 41 85 55 149 89 43 67 25 119 11 97 51 77 99 93 17 61 13 9 21
output:
172 170 168 166 164 162 160 158 156 154 150 148 146 144 142 140 138 136 128 126 124 122 120 118 116 114 112 110 108 106 104 102 100 98 96 94 90 86 84 80 78 76 74 70 68 66 62 60 58 52 48 46 44 40 38 34 32 28 26 24 18 16 14 10 173 169 165 161 157 155 147 145 135 131 129 125 115 113 109 101 75 65 63 59...
result:
wrong answer gcd(5, 15) != 1