Contest Duration: - (local time) (180 minutes)

Submission #19392740

Source Code Expand

Copy
```//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define ld long double

#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define rrep(i, a, b) for(int i = a; i >= b; --i)

#define pii pair<int, int>
#define pll pair<ll, ll>

#define fi first
#define se second

#define pb push_back
#define eb emplace_back

#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi(a,b,c,d) vector<vector<int>> a(b,vector<int>(c,d));
#define vvll(a,b,c,d) vector<vector<ll>> a(b,vector<ll>(c,d));

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define endl '\n'
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int MOD = 1000000007;
//const int MOD=998244353;
const ll INF = 1e18+1;
const int inf = 1e9+1;
const double PI = acos(-1);
int dx[8] = {1, 0, -1,  0,  1, 1, -1, -1};
int dy[8] = {0, 1,  0, -1, -1, 1,  1, -1};
bool range(int y, int x, int h, int w){
if(y < 0 || x < 0 || y >= h || x >= w) return false;
else return true;
}

const int MAX = 310000;

signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);

ll n, m;
cin >> n >> m;

ll ans = 0;
rep2(i,1,1000000000){
ll bus = (n*i+m-1)/m;
chmax(ans, bus*m-n*i);
}
cout << ans << endl;
return 0;
}```

#### Submission Info

Submission Time 2021-01-12 14:42:42+0900 D - Bus Tour cumin C++ (GCC 9.2.1) 0 1711 Byte TLE 2205 ms 3308 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
 TLE × 3
 TLE × 28
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt TLE 2205 ms 3308 KB
sample_02.txt TLE 2205 ms 3220 KB
sample_03.txt TLE 2205 ms 3284 KB
subtask_1_1.txt TLE 2205 ms 3284 KB
subtask_1_10.txt TLE 2205 ms 3228 KB
subtask_1_11.txt TLE 2205 ms 3220 KB
subtask_1_12.txt TLE 2205 ms 3200 KB
subtask_1_13.txt TLE 2205 ms 3164 KB
subtask_1_14.txt TLE 2205 ms 3260 KB
subtask_1_15.txt TLE 2205 ms 3216 KB
subtask_1_16.txt TLE 2205 ms 3260 KB
subtask_1_17.txt TLE 2205 ms 3124 KB
subtask_1_18.txt TLE 2205 ms 3224 KB
subtask_1_19.txt TLE 2205 ms 3128 KB
subtask_1_2.txt TLE 2205 ms 3208 KB
subtask_1_20.txt TLE 2205 ms 3292 KB
subtask_1_21.txt TLE 2205 ms 3264 KB
subtask_1_22.txt TLE 2205 ms 3224 KB
subtask_1_23.txt TLE 2205 ms 3260 KB
subtask_1_24.txt TLE 2205 ms 3184 KB
subtask_1_25.txt TLE 2205 ms 3284 KB
subtask_1_3.txt TLE 2205 ms 3188 KB
subtask_1_4.txt TLE 2205 ms 3128 KB
subtask_1_5.txt TLE 2205 ms 3124 KB
subtask_1_6.txt TLE 2205 ms 3192 KB
subtask_1_7.txt TLE 2205 ms 3260 KB
subtask_1_8.txt TLE 2205 ms 3284 KB
subtask_1_9.txt TLE 2205 ms 3208 KB