QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#384196#3697. Carriesucup-team1251WA 1ms5716kbC++171.1kb2024-04-09 20:56:262024-04-09 20:56:28

Judging History

This is the latest submission verdict.

  • [2024-04-09 20:56:28]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 5716kb
  • [2024-04-09 20:56:26]
  • Submitted

answer

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>

using namespace std;
#define int long long
int ai[300000];
int bi[300000];
const int N = 1e9;
int n;
int find(int sum,int z) {
    int l = sum + 1,r = n,mid;
    while(l < r) {
        mid = (l + r) / 2;
        if(bi[mid] + bi[sum] < z) l = mid + 1;
        else if(bi[mid] + bi[sum] == z) return mid;
        else r = mid;
    }
    return r;
}
void miss() {
    while(cin >> n) {
        int ans = 0;
        for(int i = 1; i <= n; i++) cin >> ai[i];
        for(int i = 10; i <= N; i = i * 10) {
            for(int j = 1; j < n; j++) bi[j] = ai[j] % i;
            sort(bi + 1,bi + 1 + n);
            for(int j = 1; j <= n; j++) {
                int qqq = 0;
                if(!bi[j]) continue;
                qqq = find(j,i);
                if(bi[j] + bi[qqq] >= i && qqq <= n) {
                ans += (n - qqq + 1);
                if(qqq <= j) ans--;
                }
            }
        }
        cout << ans << endl;
    }
}
signed main()
{
    ios::sync_with_stdio(false);;
    cin.tie(0),cout.tie(0);
    int n = 1;
    //cin >> n;
    while(n--) miss();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5716kb

input:

2
5 5

output:

0

result:

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