Submission #1073888


Source Code Expand

#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    unsigned long long int a[n],b[n];
    int loop1,loop2;
    for(loop1=0;loop1<n;loop1++){
        scanf("%lld %lld",&a[loop1],&b[loop1]);
    }
    unsigned long long int ans=0;
    for(loop1=n-1;loop1>=0;loop1--){
        if(a[loop1]%b[loop1]!=0){
            long long int temp;
            temp=b[loop1]-(a[loop1]%b[loop1]);
            for(loop2=loop1;loop2>=0;loop2--){
                a[loop2]+=temp;
            }
            ans+=temp;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Submission Info

Submission Time
Task A - Multiple Array
User infer496
Language C (GCC 5.4.1)
Score 0
Code Size 592 Byte
Status TLE
Exec Time 2102 ms
Memory 1664 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:4:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ^
./Main.c:8:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld",&a[loop1],&b[loop1]);
         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 9
TLE × 9
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt TLE 2102 ms 1664 KB
02.txt TLE 2102 ms 1664 KB
03.txt TLE 2102 ms 1664 KB
04.txt TLE 2102 ms 1664 KB
05.txt TLE 2102 ms 1664 KB
06.txt TLE 2102 ms 1664 KB
07.txt AC 21 ms 1664 KB
08.txt TLE 2102 ms 1664 KB
09.txt AC 21 ms 1664 KB
10.txt TLE 2102 ms 1664 KB
11.txt AC 21 ms 1664 KB
12.txt AC 17 ms 1664 KB
13.txt TLE 2102 ms 1664 KB
14.txt AC 27 ms 1664 KB
15.txt AC 1 ms 128 KB
16.txt AC 1 ms 128 KB
s1.txt AC 1 ms 128 KB
s2.txt AC 1 ms 128 KB