QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#238126#5693. 众数tyangWA 12ms4220kbC++14599b2023-11-04 15:50:412023-11-04 15:50:42

Judging History

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

  • [2023-11-04 15:50:42]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:4220kb
  • [2023-11-04 15:50:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N];
long long f[N];
int main(void)
{
    int n; cin >> n;
    for(int i = 1 ; i <= n ; ++ i )cin >> a[i];
    vector<int>vc;
    vc.push_back(n);
    for(int i = n - 1 ; i >= 1 ; -- i )if(a[i] > a[vc.back()])vc.push_back(i);
    int k = 0;
    for(int i = 1 ; i <= n ; ++ i ){
        if(k < vc.size() && i > a[vc[k]]){ ++ k; }
        if(k < vc.size())f[i] = f[i - 1] + vc[k];
    }
    long long res = 0;
    for(int i = 1 ; i <= n ; ++ i )res = res + f[a[i]];
    cout << res << endl;
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 12ms
memory: 3848kb

input:

99991
3 3 3 4 3 6 4 2 2 5 3 2 3 5 3 3 2 1 2 3 4 2 3 4 3 3 3 4 3 3 3 2 3 2 3 2 4 3 3 2 3 5 3 5 4 2 4 3 3 1 3 2 2 3 4 2 3 3 2 2 4 5 3 2 3 3 1 3 3 4 1 3 4 5 1 1 3 4 2 4 3 2 5 3 3 2 2 2 4 2 4 2 2 4 2 4 3 3 2 3 2 2 1 4 3 1 3 1 2 2 3 1 1 5 2 1 2 2 3 3 1 4 4 4 3 3 3 3 1 3 3 5 5 4 4 3 3 3 4 3 6 5 3 1 1 2 2 ...

output:

4973056284288

result:

ok single line: '4973056284288'

Test #2:

score: -100
Wrong Answer
time: 8ms
memory: 4220kb

input:

69992
90001 89998 90001 90001 89997 90000 90000 90002 90003 90003 90001 89999 89999 90000 90000 90000 90000 90000 90000 90001 90000 89999 90002 90001 90000 89998 89998 90001 89998 90000 90000 89999 90000 90001 89998 90000 90004 90000 90000 90001 89999 90001 90003 89998 90001 90001 90001 90001 90002 ...

output:

0

result:

wrong answer 1st lines differ - expected: '465680822171522', found: '0'