Submission #1073741
Source Code Expand
#include <bits/stdc++.h> #define lli long long int #define pb push_back #define pii pair <int, int> #define pll pair <lli, lli> #define _F first #define _S second #define mset(x) memset(x, 0, sizeof(x)) #define fastio() ios_base::sync_with_stdio(0) using namespace std; int main() { int n; cin >> n; lli A[n], B[n], M[n]; for(int i=0; i<n; i++) cin >> A[i] >> B[i]; for(int i=0; i<n; i++) M[i] = B[i] - (A[i] % B[i]); lli sum = 0; for(int i=n-1; i>=0; i--) { M[i] -= sum; if(M[i] < 0) { M[i] += (abs(M[i]) * B[i]); M[i] %= B[i]; } sum += M[i]; } cout << sum << endl; }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | nikhilhassija |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 647 Byte |
Status | WA |
Exec Time | 142 ms |
Memory | 2560 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
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 | 135 ms | 2560 KB |
02.txt | WA | 136 ms | 2560 KB |
03.txt | WA | 135 ms | 2560 KB |
04.txt | WA | 135 ms | 2560 KB |
05.txt | WA | 136 ms | 2560 KB |
06.txt | WA | 121 ms | 2560 KB |
07.txt | WA | 88 ms | 2560 KB |
08.txt | WA | 142 ms | 2560 KB |
09.txt | WA | 88 ms | 2560 KB |
10.txt | WA | 142 ms | 2560 KB |
11.txt | AC | 88 ms | 2560 KB |
12.txt | WA | 40 ms | 2560 KB |
13.txt | AC | 90 ms | 2560 KB |
14.txt | WA | 137 ms | 2560 KB |
15.txt | WA | 3 ms | 256 KB |
16.txt | WA | 3 ms | 256 KB |
s1.txt | AC | 3 ms | 256 KB |
s2.txt | AC | 3 ms | 256 KB |