QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#568917#9309. GraphyylxWA 0ms3644kbC++14685b2024-09-16 19:14:202024-09-16 19:14:21

Judging History

你现在查看的是最新测评结果

  • [2024-09-16 19:14:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3644kb
  • [2024-09-16 19:14:20]
  • 提交

answer

#include <iostream>
using namespace std;

const long long MOD = 998244353;

// Function to compute (base^exp) % mod
long long mod_pow(long long base, long long exp, long long mod) {
    long long result = 1;
    while (exp > 0) {
        if (exp % 2 == 1) {
            result = (result * base) % mod;
        }
        base = (base * base) % mod;
        exp /= 2;
    }
    return result;
}

int main() {
    long long n;
    cin >> n;
    
    // The number of "perfect" graphs with n vertices is 2^(n-1)
    // We need to calculate 2^(n-1) % 998244353
    long long result = mod_pow(2, n - 1, MOD);
    
    cout << result << endl;
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4

output:

8

result:

ok answer is '8'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3644kb

input:

2

output:

2

result:

wrong answer expected '1', found '2'