QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#676962 | #7695. Double Up | new_game_plus_players# | WA | 1ms | 4456kb | C++20 | 1.2kb | 2024-10-26 06:38:59 | 2024-10-26 06:39:01 |
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 <= 10; 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: 100
Accepted
time: 1ms
memory: 4456kb
input:
5 4 2 2 1 8
output:
16
result:
ok single line: '16'
Test #2:
score: 0
Accepted
time: 1ms
memory: 4376kb
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:
512
result:
ok single line: '512'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 4404kb
input:
1000 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650...
output:
1
result:
wrong answer 1st lines differ - expected: '649037107316853453566312041152512', found: '1'