QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#260436 | #7695. Double Up | ItsJerr# | WA | 1ms | 3856kb | C++17 | 1.6kb | 2023-11-22 09:49:43 | 2023-11-22 09:49:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
__int128 read() {
__int128 x = 0;
string s; cin >> s;
while (s.size()) {
x = x * 10 + s.back() - '0';
s.pop_back();
}
return x;
}
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) {
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: 100
Accepted
time: 0ms
memory: 3616kb
input:
5 4 2 2 1 8
output:
16
result:
ok single line: '16'
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3856kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
64
result:
wrong answer 1st lines differ - expected: '512', found: '64'