Submission #2177101
Source Code Expand
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;
/*---------------------------------------------------*/
int similarity_multiple(int a,int b){
return (a/b*b+(a%b!=0?1:0)*b);
}
int main(){
ll n,a[100005],b[100005];
cin>>n;
rep(i,n){
cin>>a[i]>>b[i];
}
reverse(a,a+n);
reverse(b,b+n);
ll ans=0;
rep(i,n){
a[i]+=ans;
ll tmp=similarity_multiple(a[i],b[i]);
ans+=tmp-a[i];
}
cout<<ans<<endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Multiple Array |
User |
mkan_0141 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1375 Byte |
Status |
WA |
Exec Time |
86 ms |
Memory |
1792 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 |
80 ms |
1792 KB |
02.txt |
WA |
80 ms |
1792 KB |
03.txt |
WA |
79 ms |
1792 KB |
04.txt |
WA |
80 ms |
1792 KB |
05.txt |
WA |
80 ms |
1792 KB |
06.txt |
WA |
80 ms |
1792 KB |
07.txt |
AC |
57 ms |
1792 KB |
08.txt |
WA |
83 ms |
1792 KB |
09.txt |
AC |
58 ms |
1792 KB |
10.txt |
WA |
83 ms |
1792 KB |
11.txt |
AC |
57 ms |
1792 KB |
12.txt |
AC |
35 ms |
1792 KB |
13.txt |
WA |
57 ms |
1792 KB |
14.txt |
AC |
86 ms |
1792 KB |
15.txt |
AC |
1 ms |
256 KB |
16.txt |
AC |
1 ms |
256 KB |
s1.txt |
AC |
1 ms |
256 KB |
s2.txt |
AC |
1 ms |
256 KB |