| Task: | Jubilee |
| Sender: | TLE |
| Submission time: | 2025-11-08 16:43:55 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | details |
| #2 | ACCEPTED | 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 | ACCEPTED | 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;
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 = m - 1;
v = k;
For(ll, i, 1, n - 1){
u = (u % mod * (m - 1) % mod) % mod;
}
For(ll, i, 1, n - 2){
v = ((v % mod * (m % mod * k % mod)) % 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: ACCEPTED
| input |
|---|
| 1 1 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 1 1000000000 |
| correct output |
|---|
| 56 |
| user output |
|---|
| 4592 |
Feedback: Incorrect character on line 1 col 1: expected "56", got "4592"
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 |
|---|
| 997431679 |
Feedback: Incorrect character on line 1 col 1: expected "298424", got "997431679"
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 1000000 1000000000 |
| correct output |
|---|
| 859388820 |
| user output |
|---|
| 643087718 |
Feedback: Incorrect character on line 1 col 1: expected "859388820", got "643087718"
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: ACCEPTED
| input |
|---|
| 1 2 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
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 |
|---|
| 748416453 |
Feedback: Incorrect character on line 1 col 1: expected "129870828", got "748416453"
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 |
|---|
| 472544043 |
Feedback: Incorrect character on line 1 col 1: expected "74219157", got "472544043"
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| 531578 913517291 |
| correct output |
|---|
| 105420893 |
| user output |
|---|
| 899445786 |
Feedback: Incorrect character on line 1 col 1: expected "105420893", got "899445786"
