Submission #16923688
Source Code Expand
Copy
#include<bits/stdc++.h> #include<atcoder/all> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() //#pragma GCC optimize ("-O3") using namespace std; using namespace atcoder; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } //--------------------------------------------------------------------------------------------------- vector<ll> enumdiv(ll n) { vector<ll> S; for (ll i = 1; i*i <= n; i++) if (n%i == 0) { S.push_back(i); if (i*i != n) S.push_back(n / i); } sort(S.begin(), S.end()); return S; } /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i @hamayanhamayan0 / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ ll N; //--------------------------------------------------------------------------------------------------- void _main() { cin >> N; ll ans = infl; auto ed = enumdiv(2 * N); fore(x, ed) { ll y = 2 * N / x; vector<ll> r(2), m(2); r[0] = 0, m[0] = x; r[1] = -1, m[1] = y; auto p = crt(r, m); if (p.first != 0 && p.second != 0) chmin(ans, p.first); } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Sum is Multiple |
User | hamayanhamayan |
Language | C++ (GCC 9.2.1 with AC Library) |
Score | 600 |
Code Size | 1936 Byte |
Status | AC |
Exec Time | 378 ms |
Memory | 3668 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 600 / 600 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00-sample-01.txt, 00-sample-02.txt |
All | 00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00-sample-01.txt | AC | 7 ms | 3500 KB |
00-sample-02.txt | AC | 3 ms | 3500 KB |
01-01.txt | AC | 3 ms | 3468 KB |
01-02.txt | AC | 232 ms | 3428 KB |
01-03.txt | AC | 310 ms | 3512 KB |
01-04.txt | AC | 234 ms | 3512 KB |
01-05.txt | AC | 351 ms | 3424 KB |
01-06.txt | AC | 271 ms | 3472 KB |
01-07.txt | AC | 232 ms | 3476 KB |
01-08.txt | AC | 295 ms | 3528 KB |
01-09.txt | AC | 217 ms | 3472 KB |
01-10.txt | AC | 342 ms | 3368 KB |
01-11.txt | AC | 321 ms | 3420 KB |
01-12.txt | AC | 342 ms | 3508 KB |
01-13.txt | AC | 365 ms | 3500 KB |
01-14.txt | AC | 292 ms | 3532 KB |
01-15.txt | AC | 375 ms | 3400 KB |
01-16.txt | AC | 251 ms | 3500 KB |
01-17.txt | AC | 157 ms | 3504 KB |
01-18.txt | AC | 345 ms | 3512 KB |
01-19.txt | AC | 310 ms | 3424 KB |
01-20.txt | AC | 222 ms | 3472 KB |
01-21.txt | AC | 216 ms | 3536 KB |
01-22.txt | AC | 300 ms | 3500 KB |
01-23.txt | AC | 243 ms | 3472 KB |
01-24.txt | AC | 378 ms | 3520 KB |
01-25.txt | AC | 360 ms | 3424 KB |
01-26.txt | AC | 185 ms | 3660 KB |
01-27.txt | AC | 220 ms | 3660 KB |
01-28.txt | AC | 252 ms | 3668 KB |
01-29.txt | AC | 259 ms | 3668 KB |
01-30.txt | AC | 285 ms | 3552 KB |
01-31.txt | AC | 333 ms | 3580 KB |
01-32.txt | AC | 341 ms | 3668 KB |
01-33.txt | AC | 362 ms | 3644 KB |
01-34.txt | AC | 163 ms | 3652 KB |
01-35.txt | AC | 95 ms | 3492 KB |
01-36.txt | AC | 257 ms | 3596 KB |
01-37.txt | AC | 111 ms | 3564 KB |
01-38.txt | AC | 205 ms | 3500 KB |
01-39.txt | AC | 71 ms | 3484 KB |
01-40.txt | AC | 110 ms | 3552 KB |