QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#260431 | #7695. Double Up | ItsJerr# | WA | 0ms | 3644kb | C++17 | 1.7kb | 2023-11-22 09:42:58 | 2023-11-22 09:43:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
__int128 read() {
__int128 x = 0, f = 1;
char ch = getchar();
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
void print(__int128 x) {
if (x < 0) {
putchar('-');
x = -x;
}
if (x > 9) print(x / 10);
putchar(x % 10 + '0');
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
if (fopen("qoj_7695.inp", "r")) {
freopen("qoj_7695.inp", "r", stdin);
freopen("qoj_7695.out", "w", stdout);
}
// #ifdef LOCAL_MACHINE
// if (fopen("task.inp", "r")) {
// freopen("task.inp", "r", stdin);
// freopen("task.out", "w", stdout);
// }
// #endif
int n; cin >> n;
vector<int> a;
for (int i = 1; i <= n; ++i) {
__int128 x = read();
int cur = 0;
while (x > 1) {
++cur;
x /= 2;
}
a.push_back(cur);
}
while (a.size() > 1) {
// for (int i : a) cerr << i << " "; cerr << "\n";
int mi = 1e9;
for (int i : a) mi = min(mi, i);
for (int i = 0; i + 1 < a.size(); ++i) if (a[i] == a[i + 1] && a[i] == mi) {
a.erase(a.begin() + i); a.erase(a.begin() + i); a.insert(a.begin() + i, mi + 1);
break;
}
for (int i = 0; i < a.size(); ++i) if (a[i] == mi) {
a.erase(a.begin() + i);
break;
}
}
__int128 res = 1;
int val = a.back();
while (val--) res *= 2;
print(res);
}
// ඞඞඞඞඞ you sus
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3644kb
input:
5 4 2 2 1 8
output:
4
result:
wrong answer 1st lines differ - expected: '16', found: '4'