Submission #72586890


Source Code Expand

#include<bits/stdc++.h>
#include<atcoder/all>
#define mp make_pair
#define fast std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr)
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = atcoder::modint998244353;
constexpr ll inf = 2e18;
constexpr ll mod = 998244353;

static void judge(bool c) {
    std::cout << (c ? "Yes" : "No") << '\n';
}

class BinomialCoefficient {
private:
    long long mod;
    std::vector<long long> fact;
    std::vector<long long> inv_fact;

    long long power(long long base, long long exp) {
        long long res = 1;
        base %= mod;
        while (exp > 0) {
            if (exp % 2 == 1) res = (res * base) % mod;
            base = (base * base) % mod;
            exp /= 2;
        }
        return res;
    }

public:
    BinomialCoefficient(int n_max, long long m) : mod(m) {
        fact.resize(n_max + 1);
        inv_fact.resize(n_max + 1);

        fact[0] = 1;
        inv_fact[0] = 1;

        for (int i = 1; i <= n_max; ++i) {
            fact[i] = (fact[i - 1] * i) % mod;
        }

        inv_fact[n_max] = power(fact[n_max], mod - 2);

        for (int i = n_max; i > 0; --i) {
            inv_fact[i - 1] = (inv_fact[i] * i) % mod;
        }
    }

    long long com(int n, int r) {
        if (r < 0 || n < r) {
            return 0;
        }
        if (static_cast<size_t>(n) >= fact.size()) {
            return -1;
        }
        long long result = fact[n];
        result = (result * inv_fact[r]) % mod;
        result = (result * inv_fact[n - r]) % mod;
        return result;
    }
};

int n;
string s;
int main(){
    cin >> n >> s;
    swap(s[n - 1],s[n - 2]);
    cout << s << endl;
    return 0;
}

Submission Info

Submission Time
Task A - EGFスワップ
User guild2026_097
Language C++23 (GCC 15.2.0)
Score 100
Code Size 1862 Byte
Status AC
Exec Time 1 ms
Memory 3644 KiB

Compile Error

./Main.cpp:14:13: warning: 'void judge(bool)' defined but not used [-Wunused-function]
   14 | static void judge(bool c) {
      |             ^~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 14
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.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
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3600 KiB
00_sample_01.txt AC 1 ms 3356 KiB
00_sample_02.txt AC 1 ms 3524 KiB
01_random_00.txt AC 1 ms 3620 KiB
01_random_01.txt AC 1 ms 3428 KiB
01_random_02.txt AC 1 ms 3620 KiB
01_random_03.txt AC 1 ms 3632 KiB
01_random_04.txt AC 1 ms 3644 KiB
01_random_05.txt AC 1 ms 3456 KiB
01_random_06.txt AC 1 ms 3576 KiB
01_random_07.txt AC 1 ms 3584 KiB
01_random_08.txt AC 1 ms 3476 KiB
01_random_09.txt AC 1 ms 3356 KiB
01_random_10.txt AC 1 ms 3468 KiB