Submission #1073453
Source Code Expand
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <vector> #define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i)) #define rep(i,n) FOR(i,0,n) #define pb push_back #define all(v) begin(v), end(v) #define debug(x) cerr<< #x <<": "<<x<<endl #define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vector<int> > vvi; typedef vector<ll> vll; typedef vector<vector<ll> > vvll; template<class T> using vv=vector<vector< T > >; int main() { int n; scanf("%d", &n); vll a(n), b(n); rep (i, n) { scanf("%lld %lld", &a[i], &b[i]); } ll cnt = 0; for (int i = n-1; i >= 0; --i) { ll r = (a[i] + cnt) % b[i]; if (r == 0) { continue; } cnt += (b[i] - r); } printf("%lld\n", cnt); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Array |
User | tspcx |
Language | C++14 (Clang 3.8.0) |
Score | 300 |
Code Size | 1218 Byte |
Status | AC |
Exec Time | 28 ms |
Memory | 1792 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 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 | AC | 27 ms | 1792 KB |
02.txt | AC | 28 ms | 1792 KB |
03.txt | AC | 28 ms | 1792 KB |
04.txt | AC | 28 ms | 1792 KB |
05.txt | AC | 28 ms | 1792 KB |
06.txt | AC | 28 ms | 1792 KB |
07.txt | AC | 23 ms | 1792 KB |
08.txt | AC | 28 ms | 1792 KB |
09.txt | AC | 23 ms | 1792 KB |
10.txt | AC | 28 ms | 1792 KB |
11.txt | AC | 23 ms | 1792 KB |
12.txt | AC | 19 ms | 1792 KB |
13.txt | AC | 23 ms | 1792 KB |
14.txt | AC | 28 ms | 1792 KB |
15.txt | AC | 3 ms | 256 KB |
16.txt | AC | 3 ms | 256 KB |
s1.txt | AC | 3 ms | 256 KB |
s2.txt | AC | 3 ms | 256 KB |