QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#379623 | #3697. Carries | wanyurukong | WA | 0ms | 3608kb | C++17 | 824b | 2024-04-06 17:59:10 | 2024-04-06 17:59:12 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<bitset>
#include<vector>
#include<queue>
#include<set>
#include<map>
#define int long long
using namespace std;
const int N=1e4+10;
int n;
int a[N];
vector<int> V[15];
signed main()
{
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=n;i++)
{
int x=10;
for(int j=1;j<=10;j++)
{
if(a[i]%x==0)continue;
V[j].push_back(a[i]%x);
x*=10;
}
}
int s=0;
for(int i=1;i<=n;i++)
{
int x=10;
for(int j=1;j<=10;j++)
{
int xx=a[i]%x;
int y=x-xx;
int yy=lower_bound(V[j].begin(),V[j].end(),y)-V[j].begin();
s+=n-yy;
x*=10;
}
}
for(int i=1;i<=n;i++)
{
int x=10;
for(int j=1;j<=10;j++)
{
int xx=a[i]%x;
if(xx+xx>=x)
s--;
}
}
cout<<s/2<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3608kb
input:
2 5 5
output:
-8
result:
wrong answer 1st numbers differ - expected: '1', found: '-8'