QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#676964 | #7695. Double Up | new_game_plus_players# | WA | 1ms | 4440kb | C++20 | 1.2kb | 2024-10-26 06:39:43 | 2024-10-26 06:39:44 |
Judging History
answer
#include <bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef __int128_t i128;
cs int N = 1e3 + 5, M = 105;
int n, f[N][M], g[N][M];
i128 a[N];
i128 read() {
i128 x = 0; char c = getchar();
while(!isdigit(c)) c = getchar();
while(isdigit(c)) x = x * 10 + c - '0', c = getchar();
return x;
}
int lg(i128 x) {
int res = 0;
while(x) x >>= 1, res++;
return res - 1;
}
void out(i128 x){
if(x > 9) out(x / 10);
putchar(x % 10 + '0');
}
int main() {
#ifdef zqj
freopen("1.in","r",stdin);
#endif
cin >> n;
for(int i = 1; i <= n; i++) a[i] = read();
memset(f, 0x3f, sizeof f);
memset(g, 0x3f, sizeof g);
for(int i = 1; i <= n; i++) {
f[i][lg(a[i])] = i;
}
int ans = 0;
for(int i = 0; i <= 120; i++) {
for(int j = n; j; j--) {
int p = f[j][i];
g[j][i] = min(f[j][i], g[j + 1][i]);
if(p <= n) ans = i;
++ p;
if(p > n) continue;
// cout << i << ' ' << j << ' ' << f[j][i] <<' ' << g[p][i] << endl;
f[j][i + 1] = g[p][i];
}
}
out((i128)1 << ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4440kb
input:
5 4 2 2 1 8
output:
324518553658426726783156020576256
result:
wrong answer 1st lines differ - expected: '16', found: '324518553658426726783156020576256'