QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#560774#3946. Climbing StairsLaVuna47#AC ✓0ms3796kbC++171.8kb2024-09-12 17:50:132024-09-12 17:50:14

Judging History

This is the latest submission verdict.

  • [2024-09-12 17:50:14]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3796kb
  • [2024-09-12 17:50:13]
  • Submitted

answer

/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, n) for(int i = 0; i < n; ++i)
#define RFOR(i, n) for(int i = n-1; i >= 0; --i)
#define output_vec(vec) { FOR(i_, sz(vec)) cout << vec[i_] << ' '; cout << '\n'; }
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<bool> vb;
typedef short si;
typedef unsigned long long ull;
typedef long double LD;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif


int solve()
{
    ll n, r, k;
    if(!(cin >> n >> r >> k))
        return 1;
    if(r > k)
    {
        if(r >= n) cout << 2*r << '\n';
        else cout << (n + (min((n-r)%2, (n-r)%2)) + r) << '\n';
    }
    else
    {
        if(k+k-r >= n) cout << 2*k << '\n';
        else cout << (n+r + ((n-r)%2)) << '\n';
    }
    return 0;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int TET = 1e9;
    //cin >> TET;
    for (int i = 1; i <= TET; i++)
    {
        if (solve())
        {
            break;
        }
#ifdef ONPC
        cout << "__________________________" << endl;
#endif
    }
#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}

詳細信息

Test #1:

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

input:

20 10 5

output:

30

result:

ok single line: '30'

Test #2:

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

input:

100 300 800

output:

1600

result:

ok single line: '1600'

Test #3:

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

input:

100 800 301

output:

1600

result:

ok single line: '1600'

Test #4:

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

input:

100 801 300

output:

1602

result:

ok single line: '1602'

Test #5:

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

input:

100 801 301

output:

1602

result:

ok single line: '1602'

Test #6:

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

input:

101 800 300

output:

1600

result:

ok single line: '1600'

Test #7:

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

input:

101 800 301

output:

1600

result:

ok single line: '1600'

Test #8:

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

input:

101 801 300

output:

1602

result:

ok single line: '1602'

Test #9:

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

input:

101 801 301

output:

1602

result:

ok single line: '1602'

Test #10:

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

input:

300 100 800

output:

1600

result:

ok single line: '1600'

Test #11:

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

input:

300 100 801

output:

1602

result:

ok single line: '1602'

Test #12:

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

input:

300 101 800

output:

1600

result:

ok single line: '1600'

Test #13:

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

input:

100 300 801

output:

1602

result:

ok single line: '1602'

Test #14:

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

input:

300 101 801

output:

1602

result:

ok single line: '1602'

Test #15:

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

input:

301 100 800

output:

1600

result:

ok single line: '1600'

Test #16:

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

input:

301 100 801

output:

1602

result:

ok single line: '1602'

Test #17:

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

input:

301 101 800

output:

1600

result:

ok single line: '1600'

Test #18:

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

input:

301 101 801

output:

1602

result:

ok single line: '1602'

Test #19:

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

input:

300 800 100

output:

1600

result:

ok single line: '1600'

Test #20:

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

input:

300 800 101

output:

1600

result:

ok single line: '1600'

Test #21:

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

input:

300 801 100

output:

1602

result:

ok single line: '1602'

Test #22:

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

input:

300 801 101

output:

1602

result:

ok single line: '1602'

Test #23:

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

input:

301 800 100

output:

1600

result:

ok single line: '1600'

Test #24:

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

input:

100 301 800

output:

1600

result:

ok single line: '1600'

Test #25:

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

input:

301 800 101

output:

1600

result:

ok single line: '1600'

Test #26:

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

input:

301 801 100

output:

1602

result:

ok single line: '1602'

Test #27:

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

input:

301 801 101

output:

1602

result:

ok single line: '1602'

Test #28:

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

input:

800 100 300

output:

900

result:

ok single line: '900'

Test #29:

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

input:

800 100 301

output:

900

result:

ok single line: '900'

Test #30:

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

input:

800 101 300

output:

902

result:

ok single line: '902'

Test #31:

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

input:

800 101 301

output:

902

result:

ok single line: '902'

Test #32:

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

input:

801 100 300

output:

902

result:

ok single line: '902'

Test #33:

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

input:

801 100 301

output:

902

result:

ok single line: '902'

Test #34:

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

input:

801 101 300

output:

902

result:

ok single line: '902'

Test #35:

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

input:

100 301 801

output:

1602

result:

ok single line: '1602'

Test #36:

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

input:

801 101 301

output:

902

result:

ok single line: '902'

Test #37:

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

input:

800 300 100

output:

1100

result:

ok single line: '1100'

Test #38:

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

input:

800 300 101

output:

1100

result:

ok single line: '1100'

Test #39:

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

input:

800 301 100

output:

1102

result:

ok single line: '1102'

Test #40:

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

input:

800 301 101

output:

1102

result:

ok single line: '1102'

Test #41:

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

input:

801 300 100

output:

1102

result:

ok single line: '1102'

Test #42:

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

input:

801 300 101

output:

1102

result:

ok single line: '1102'

Test #43:

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

input:

801 301 100

output:

1102

result:

ok single line: '1102'

Test #44:

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

input:

801 301 101

output:

1102

result:

ok single line: '1102'

Test #45:

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

input:

101 300 800

output:

1600

result:

ok single line: '1600'

Test #46:

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

input:

101 300 801

output:

1602

result:

ok single line: '1602'

Test #47:

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

input:

101 301 800

output:

1600

result:

ok single line: '1600'

Test #48:

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

input:

101 301 801

output:

1602

result:

ok single line: '1602'

Test #49:

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

input:

100 800 300

output:

1600

result:

ok single line: '1600'