QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#216016#5149. Best Carry Playerkrito2023#WA 40ms3736kbC++20822b2023-10-15 15:10:132023-10-15 15:10:14

Judging History

This is the latest submission verdict.

  • [2023-10-15 15:10:14]
  • Judged
  • Verdict: WA
  • Time: 40ms
  • Memory: 3736kb
  • [2023-10-15 15:10:13]
  • Submitted

answer

#include<bits/stdc++.h>
#define pii pair<int,int>
#define x first
#define y second
#define int long long
using namespace std;

const int N=2e5+5;
void slove(){
    int n,s,res=0,ans,tmp;cin>>n;
    cin>>s;
    for(int i=2,x;i<=n;++i){
        cin>>x;
        tmp = ans=s+x;
        bool f1=1,f2=1;
        while(tmp){
            int a=tmp%10,b=s%10,c=x%10,flag=0;
            if(s==0)f1=0;
            if(x==0)f2=0;
            if(f1&&a<b){
                flag=1;
            }
            if(f2&&a<c){
                flag=1;
            }
            if(flag)    ++res;
            tmp/=10,s/=10,x/=10;
        }
        s = ans;
    }
    cout<<res<<"\n";
}

signed main()
{
    ios::sync_with_stdio(0);
    int t;cin>>t;
    while(t--){
        slove();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3736kb

input:

2
3
9 99 999
1
12345

output:

5
0

result:

ok 2 number(s): "5 0"

Test #2:

score: 0
Accepted
time: 40ms
memory: 3672kb

input:

100000
1
481199252
1
634074578
1
740396295
1
579721198
1
503722503
1
202647942
1
268792718
1
443917727
1
125908043
1
717268783
1
150414369
1
519096230
1
856168102
1
674936674
1
274667941
1
527268921
1
421436316
1
286802932
1
646837311
1
451394766
1
105650419
1
302790137
1
254786900
1
76141081
1
7393...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 numbers

Test #3:

score: -100
Wrong Answer
time: 12ms
memory: 3660kb

input:

10000
10
598196518 640274071 983359971 71550121 96204862 799843967 446173607 796619138 402690754 223219513
10
312183499 905549873 673542337 566661387 879397647 434495917 631413076 150918417 579868000 224422012
10
525305826 535526356 404334728 653535984 998133227 879226371 59632864 356493387 62611196...

output:

41
41
42
35
42
34
44
38
39
46
31
40
42
38
38
40
39
39
37
41
36
41
38
42
41
39
39
44
34
40
36
40
41
41
39
35
50
39
41
33
44
42
46
41
35
42
35
41
38
37
34
44
38
43
38
39
41
36
35
44
37
38
40
41
43
44
39
43
40
42
37
40
37
42
39
40
42
42
41
39
37
41
36
41
41
40
44
35
37
43
40
36
36
43
41
41
43
43
31
38
...

result:

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