QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#87531#3656. Piece of Cake!rania__#AC ✓2ms3436kbC++141.5kb2023-03-13 16:29:552023-03-13 16:29:59

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-13 16:29:59]
  • Judged
  • Verdict: AC
  • Time: 2ms
  • Memory: 3436kb
  • [2023-03-13 16:29:55]
  • Submitted

answer

#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int N = 2e5+7, P1 = 31, P2 = 37, mod= 1e9 + 7;

int mul(int a, int b) {
    return (1LL * a * b) % mod;
}

int add(int a, int b) {
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return (a + b) % mod;
}

int fp(int b, int p) {
    if (b == 1 or p == 0)
        return 1;

    int ret = fp(b, p >> 1);
    ret = mul(ret, ret);

    if (p & 1)
        ret = mul(ret, b);

    return ret;
}

ll modInv(ll n) {
    return fp(n, mod - 2);
}

ll fact[N], inv[N];

void pre() {
    fact[0] = inv[0] = 1;
    for (ll i = 1; i < N; i++)
        fact[i] = (fact[i - 1] * i) % mod, inv[i] = fp(fact[i], mod - 2);
}

ll nCr(ll n, ll r) {
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll nPr(ll n, ll r) {
    return ((fact[n] * inv[n - r])) % mod;
}

void doWork() {
    ll n,a,b;
    cin >> n >> a >> b;
    b = max(b,n-b);
    a = max(a,n-a);
    cout << a*b*4 << endl;
}


int main() {
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
//    freopen("bisector.in","r",stdin);
//    freopen("bisector.out","w",stdout);
    int t = 1;
    // cout << primes.size() << endl;
  //  cin >> t;
    while (t--) {
        doWork();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3256kb

input:

10 4 7

output:

168

result:

ok single line: '168'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3324kb

input:

5 2 2

output:

36

result:

ok single line: '36'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

4 2 1

output:

24

result:

ok single line: '24'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3256kb

input:

2 1 1

output:

4

result:

ok single line: '4'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3324kb

input:

4971 3905 2934

output:

45829080

result:

ok single line: '45829080'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3288kb

input:

9560 3579 8269

output:

197827556

result:

ok single line: '197827556'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3280kb

input:

2283 1155 573

output:

7900200

result:

ok single line: '7900200'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3368kb

input:

1555 1267 514

output:

5275788

result:

ok single line: '5275788'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3284kb

input:

8727 2408 5082

output:

128452632

result:

ok single line: '128452632'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3304kb

input:

1620 1495 152

output:

8778640

result:

ok single line: '8778640'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

5411 3868 4586

output:

70954592

result:

ok single line: '70954592'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3364kb

input:

1651 725 890

output:

3296560

result:

ok single line: '3296560'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3320kb

input:

5182 5005 1676

output:

70190120

result:

ok single line: '70190120'

Test #14:

score: 0
Accepted
time: 2ms
memory: 3276kb

input:

9054 7816 7254

output:

226789056

result:

ok single line: '226789056'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3252kb

input:

10000 5000 5000

output:

100000000

result:

ok single line: '100000000'

Test #16:

score: 0
Accepted
time: 2ms
memory: 3364kb

input:

8543 4268 1021

output:

128626200

result:

ok single line: '128626200'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3432kb

input:

8991 231 1529

output:

261468480

result:

ok single line: '261468480'

Test #18:

score: 0
Accepted
time: 2ms
memory: 3368kb

input:

6536 5819 6432

output:

149711232

result:

ok single line: '149711232'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3432kb

input:

20 16 11

output:

704

result:

ok single line: '704'

Test #20:

score: 0
Accepted
time: 2ms
memory: 3312kb

input:

3998 2992 1333

output:

31894720

result:

ok single line: '31894720'

Test #21:

score: 0
Accepted
time: 2ms
memory: 3312kb

input:

1033 392 455

output:

1481992

result:

ok single line: '1481992'

Test #22:

score: 0
Accepted
time: 2ms
memory: 3260kb

input:

3911 3291 584

output:

43796628

result:

ok single line: '43796628'

Test #23:

score: 0
Accepted
time: 2ms
memory: 3316kb

input:

10000 1 1

output:

399920004

result:

ok single line: '399920004'

Test #24:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

10000 1 9999

output:

399920004

result:

ok single line: '399920004'

Test #25:

score: 0
Accepted
time: 2ms
memory: 3252kb

input:

10000 9999 1

output:

399920004

result:

ok single line: '399920004'

Test #26:

score: 0
Accepted
time: 1ms
memory: 3280kb

input:

10000 9999 9999

output:

399920004

result:

ok single line: '399920004'

Test #27:

score: 0
Accepted
time: 1ms
memory: 3280kb

input:

6313 6210 3446

output:

85598640

result:

ok single line: '85598640'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3316kb

input:

665 266 524

output:

836304

result:

ok single line: '836304'

Test #29:

score: 0
Accepted
time: 2ms
memory: 3256kb

input:

7963 3318 7523

output:

139777340

result:

ok single line: '139777340'