QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#546539 | #7695. Double Up | Olegpresnyakov# | WA | 0ms | 3864kb | C++20 | 1.2kb | 2024-09-04 08:48:04 | 2024-09-04 08:48:05 |
Judging History
answer
#include <algorithm>
#include <vector>
#include <iostream>
#include <array>
#include <queue>
#include <bitset>
#include <math.h>
#include <iomanip>
using namespace std;
#define ar array
typedef long long ll;
typedef int uci;
#define F first
#define S second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define irep(i, a, b) for(int i = a; i > (b); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
#define ve vector
typedef ve<int> vi;
typedef ve<vi> vvi;
#define int long long
signed main(){
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
rep(i, 0, n){
cin >> a[i];
}
deque<int> q;
q.push_back(a[0]);
for(int i = 1; i < n; ++i){
while(q.size() >= 2 && a[i] > q.back() && q[q.size() - 2] > q.back()){
q.pop_back();
}
if(a[i] == q.back()){
int x = a[i];
while(!q.empty() && x == q.back()){
q.pop_back();
x += x;
}
q.push_back(x);
}
else{
q.push_back(a[i]);
}
}
cout << q.back() << "\n";
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
input:
5 4 2 2 1 8
output:
16
result:
ok single line: '16'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3864kb
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:
8
result:
wrong answer 1st lines differ - expected: '512', found: '8'