QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#237196 | #7695. Double Up | willow# | WA | 0ms | 3768kb | C++17 | 915b | 2023-11-04 13:27:14 | 2023-11-04 13:27:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
#define ll __int128
int n;
ll A[N];
char s[N];
vector < ll > all;
void read(ll &x) {
char c = getchar();
x = 0;
while(!isdigit(c)) {
c = getchar();
}
while(isdigit(c)) {
x = x * 10 + c - '0';
c = getchar();
}
}
void write(int x) {
if(!x) return;
write(x / 10);
cout << (int)(x % 10);
}
int main() {
scanf("%d", &n);
for(int i = 1; i <= n; ++ i) {
read(A[i]);
if(!all.size()) {
all.push_back(A[i]);
continue;
}
while(all.size() && all.back() < A[i]) all.pop_back();
all.push_back(A[i]);
while(all.size() >= 2 && all.back() == all[all.size() - 2]) {
all.pop_back();
all[all.size() - 1] *= 2;
}
}
write(all[0]);
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3688kb
input:
5 4 2 2 1 8
output:
16
result:
ok single line: '16'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3616kb
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: 0ms
memory: 3768kb
input:
1000 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650...
output:
result:
wrong answer 1st lines differ - expected: '649037107316853453566312041152512', found: ''