提出 #58186053


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
const char nl = '\n';
const char sp = ' ';
const int inf = 0x3f3f3f3f;
const string OUT[2]{ "NO", "YES" };
const string out[2]{ "No", "Yes" };
#define all(a) a.begin(), a.end()
#define dbg(a) cerr << (#a) << " = " << a << nl
#define OK() cerr << "OK until line " << __LINE__ << nl
using ll = long long;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ifstream fin(".in");
ofstream fout(".out");

auto start_time = chrono::high_resolution_clock::now();

double amcbn() {
    auto end_time = chrono::high_resolution_clock::now();
    return chrono::duration<double>(end_time - start_time).count();
}

template<typename T>
int rand(T a, T b) { return uniform_int_distribution<T>(a, b)(rng); }

template<typename T1, typename T2>
bool ckmax(T1& a, T2 b) { return a < b ? a = b, true : false; }

template<typename T1, typename T2>
bool ckmin(T1& a, T2 b) { return a > b ? a = b, true : false; }

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int answer = 0;
    for (char cur = 'B', last = 'A'; cur <= 'Z'; ++last, ++cur) {
        answer += abs((int)s.find(cur) - (int)s.find(last));
    }
    cout << answer;
}

提出情報

提出日時
問題 B - 1D Keyboard
ユーザ amcbn
言語 C++ 20 (gcc 12.2)
得点 200
コード長 1259 Byte
結果 AC
実行時間 1 ms
メモリ 3676 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 28
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 02_hand_00.txt, 02_hand_01.txt, 02_hand_02.txt, 02_hand_03.txt, 02_hand_04.txt, 02_hand_05.txt, 02_hand_06.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3548 KiB
00_sample_01.txt AC 1 ms 3388 KiB
01_random_00.txt AC 1 ms 3532 KiB
01_random_01.txt AC 1 ms 3556 KiB
01_random_02.txt AC 1 ms 3676 KiB
01_random_03.txt AC 1 ms 3676 KiB
01_random_04.txt AC 1 ms 3620 KiB
01_random_05.txt AC 1 ms 3564 KiB
01_random_06.txt AC 1 ms 3528 KiB
01_random_07.txt AC 1 ms 3552 KiB
01_random_08.txt AC 1 ms 3548 KiB
01_random_09.txt AC 1 ms 3560 KiB
01_random_10.txt AC 1 ms 3520 KiB
01_random_11.txt AC 1 ms 3520 KiB
01_random_12.txt AC 1 ms 3508 KiB
01_random_13.txt AC 1 ms 3552 KiB
01_random_14.txt AC 1 ms 3552 KiB
01_random_15.txt AC 1 ms 3556 KiB
01_random_16.txt AC 1 ms 3540 KiB
01_random_17.txt AC 1 ms 3544 KiB
01_random_18.txt AC 1 ms 3596 KiB
02_hand_00.txt AC 1 ms 3552 KiB
02_hand_01.txt AC 1 ms 3544 KiB
02_hand_02.txt AC 1 ms 3584 KiB
02_hand_03.txt AC 1 ms 3516 KiB
02_hand_04.txt AC 1 ms 3520 KiB
02_hand_05.txt AC 1 ms 3560 KiB
02_hand_06.txt AC 1 ms 3548 KiB