QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#237196#7695. Double Upwillow#WA 0ms3768kbC++17915b2023-11-04 13:27:142023-11-04 13:27:14

Judging History

你现在查看的是最新测评结果

  • [2023-11-04 13:27:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3768kb
  • [2023-11-04 13:27:14]
  • 提交

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: ''