Submission #1073412


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define debug0(x) printf("! %d\n", x);
#define debug1(x, a, b) for(int (ii)=(a);(ii)<(b);(ii++)) printf("%d: %d\n", ii, x[ii]);
#define nono(x, ite) for(__typeof((x).begin()) (ite)=(x).begin();(ite)!=(x).end();(ite++))

typedef long long ll;

const int N = 1e5 + 10;

ll a[N], b[N];
int n;

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d", a + i, b + i);
  }
  ll ans = 0;
  for (int i = n; i >= 1; i--) {
    a[i] = (a[i] + ans) % b[i];
    a[i] %= b[i];
    ans += (b[i] - a[i]) % b[i];
  }
  printf("%I64d\n", ans);
  return 0;
}

Submission Info

Submission Time
Task A - Multiple Array
User kakapo2000
Language C++14 (GCC 5.4.1)
Score 0
Code Size 733 Byte
Status WA
Exec Time 119 ms
Memory 1792 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:23:37: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘ll* {aka long long int*}’ [-Wformat=]
     scanf("%I64d%I64d", a + i, b + i);
                                     ^
./Main.cpp:23:37: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘ll* {aka long long int*}’ [-Wformat=]
./Main.cpp:31:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ll {aka long long int}’ [-Wformat=]
   printf("%I64d\n", ans);
                        ^
./Main.cpp:21:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
                  ^
./Main.cpp:23:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%I64d%I64d", a + i, b + i);
                                      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
WA × 2
WA × 18
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 WA 119 ms 1792 KB
02.txt WA 119 ms 1792 KB
03.txt WA 119 ms 1792 KB
04.txt WA 119 ms 1792 KB
05.txt WA 119 ms 1792 KB
06.txt WA 119 ms 1792 KB
07.txt WA 79 ms 1792 KB
08.txt WA 89 ms 1792 KB
09.txt WA 78 ms 1792 KB
10.txt WA 89 ms 1792 KB
11.txt WA 78 ms 1792 KB
12.txt WA 39 ms 1792 KB
13.txt WA 79 ms 1792 KB
14.txt WA 59 ms 1792 KB
15.txt WA 3 ms 256 KB
16.txt WA 3 ms 256 KB
s1.txt WA 3 ms 256 KB
s2.txt WA 3 ms 256 KB