| Task: | Jubilee |
| Sender: | TLE |
| Submission time: | 2025-11-08 16:47:53 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | details |
| #2 | WRONG ANSWER | 0.00 s | details |
| #3 | WRONG ANSWER | 0.00 s | details |
| #4 | ACCEPTED | 0.00 s | details |
| #5 | WRONG ANSWER | 0.00 s | details |
| #6 | WRONG ANSWER | 0.02 s | details |
| #7 | ACCEPTED | 0.00 s | details |
| #8 | ACCEPTED | 0.02 s | details |
| #9 | WRONG ANSWER | 0.00 s | details |
| #10 | ACCEPTED | 0.02 s | details |
| #11 | WRONG ANSWER | 0.02 s | details |
| #12 | WRONG ANSWER | 0.00 s | details |
| #13 | WRONG ANSWER | 0.00 s | details |
| #14 | WRONG ANSWER | 0.01 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(type, i, a, b) for (type i = (a); i <= (b); ++i)
ll n, m, k, u, v, x;
ll res;
const ll mod = 1e9 + 7;
void FastIn(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
}
void ReadIn(){
cin >> n >> m;
if(n == 1 && m == 1){
cout << 1 << endl;
}
else {
k = ((m - 2) % mod * (m - 2) % mod) % mod;
// res = ((m % mod * (m - 1) % mod) % mod * pow((m - 1) % mod, n - 1) % mod) % mod + ((m % mod * (m - 1) % mod) % mod * pow(((m - 2) % mod * (m - 2) % mod) % mod, n - 1) % mod) % mod;
// res = res % mod;
u = 1;
v = 1;
For(ll, i, 1, n){
u = (u % mod * (m - 1) % mod) % mod;
}
For(ll, i, 1, n - 1){
v = (v % mod * k % mod) % mod;
}
x = m % mod * (m - 1) % mod;
res = (m % mod * u % mod) % mod + (x % mod * v % mod) % mod;
res = (res % mod + mod) % mod;
cout << res;
}
}
int main(){
FastIn();
ReadIn();
}
// g++ -o output
// g++ F.cpp
// ./f.out
// 1000000 1000000000Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 3 2 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 1 1 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 1 |
Feedback: Incorrect character on line 1 col 1: expected "0", got "1"
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 1 1000000000 |
| correct output |
|---|
| 56 |
| user output |
|---|
| 112 |
Feedback: Incorrect character on line 1 col 1: expected "56", got "112"
Test 4
Verdict: ACCEPTED
| input |
|---|
| 2 1000000000 |
| correct output |
|---|
| 4088 |
| user output |
|---|
| 4088 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 3 1000000000 |
| correct output |
|---|
| 298424 |
| user output |
|---|
| 371000 |
Feedback: Incorrect character on line 1 col 1: expected "298424", got "371000"
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 1000000 1000000000 |
| correct output |
|---|
| 859388820 |
| user output |
|---|
| 416775251 |
Feedback: Incorrect character on line 1 col 1: expected "859388820", got "416775251"
Test 7
Verdict: ACCEPTED
| input |
|---|
| 2 1 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 8
Verdict: ACCEPTED
| input |
|---|
| 1000000 1 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 1 2 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 4 |
Feedback: Incorrect character on line 1 col 1: expected "2", got "4"
Test 10
Verdict: ACCEPTED
| input |
|---|
| 1000000 2 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 1000000 3 |
| correct output |
|---|
| 129870828 |
| user output |
|---|
| 705126183 |
Feedback: Incorrect character on line 1 col 1: expected "129870828", got "705126183"
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 1 3 |
| correct output |
|---|
| 6 |
| user output |
|---|
| 12 |
Feedback: Incorrect character on line 1 col 1: expected "6", got "12"
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| 21355 1239478 |
| correct output |
|---|
| 74219157 |
| user output |
|---|
| 110934677 |
Feedback: Incorrect character on line 1 col 1: expected "74219157", got "110934677"
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| 531578 913517291 |
| correct output |
|---|
| 105420893 |
| user output |
|---|
| 339710142 |
Feedback: Incorrect character on line 1 col 1: expected "105420893", got "339710142"
