| Task: | Lucky prefixes |
| Sender: | freefoodfreepoints |
| Submission time: | 2025-11-08 14:50:58 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | WRONG ANSWER | 0.04 s | details |
| #3 | WRONG ANSWER | 0.00 s | details |
| #4 | WRONG ANSWER | 0.00 s | details |
| #5 | WRONG ANSWER | 0.11 s | details |
| #6 | WRONG ANSWER | 0.00 s | details |
| #7 | WRONG ANSWER | 0.01 s | details |
| #8 | WRONG ANSWER | 0.05 s | details |
| #9 | WRONG ANSWER | 0.11 s | details |
| #10 | WRONG ANSWER | 0.00 s | details |
| #11 | WRONG ANSWER | 0.00 s | details |
| #12 | WRONG ANSWER | 0.11 s | details |
| #13 | WRONG ANSWER | 0.00 s | details |
| #14 | WRONG ANSWER | 0.01 s | details |
| #15 | WRONG ANSWER | 0.05 s | details |
| #16 | WRONG ANSWER | 0.11 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define til(n) for(ll i = 0; i < n; i++)
constexpr ll mod = 1e9+7;
ll euclid(ll a, ll b, ll& x, ll& y){
if (!b) return x=1,y=0,a;
ll d = euclid(b,a%b,y,x);
return y-=a/b * x, d;
}
struct Mod {
ll x;
Mod(ll xx) : x(xx) {}
Mod operator* (Mod b) { return Mod((x * b.x) % mod); }
Mod operator/ (Mod b) { return *this * invert(b); }
Mod invert(Mod a) {
ll x,y,g = euclid(a.x,mod,x,y);
assert (g==1);
return Mod((x+mod) % mod);
}
};
auto fac(ll n) {
auto total = Mod(1);
til(n) {
total = (total * (i + 1));
}
return total;
}
int main() {
cin.tie(0)->sync_with_stdio(false);
cout.tie(0)->sync_with_stdio(false);
ll n;
unordered_map<string,ll> m;
cin >> n;
til(n) {
string s;
ll _;
cin >> s >> _;
m[s]++;
}
auto total = fac(n);
for (auto [k, v] : m) {
total = total / fac(v);
}
cout << total.x << '\n';
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 6 4 3 -2 1 5 6 1 2 1 3 2 2 3 1 3 -2 ... |
| correct output |
|---|
| YES NO NO |
| user output |
|---|
| 360 |
Feedback: Output is shorter than expected
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 200000 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 637894743 |
Feedback: Output is shorter than expected
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 629447384 -729045992 811583872... |
| correct output |
|---|
| YES NO NO NO NO ... |
| user output |
|---|
| 907200 |
Feedback: Output is shorter than expected
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 1 200000 629447384 1 1 670017180 1 1 826751744 1 1 -804919168 ... |
| correct output |
|---|
| NO NO NO YES YES ... |
| user output |
|---|
| 1 |
Feedback: Output is shorter than expected
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 200000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 841700673 |
Feedback: Output is shorter than expected
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 1000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 640753664 |
Feedback: Output is shorter than expected
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 10000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 333236525 |
Feedback: Output is shorter than expected
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 286267582 |
Feedback: Output is shorter than expected
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 200000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 841700673 |
Feedback: Output is shorter than expected
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 629447384 -729045992 811583872... |
| correct output |
|---|
| YES NO NO NO NO ... |
| user output |
|---|
| 907200 |
Feedback: Output is shorter than expected
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 1 200000 629447384 1 1 670017180 1 1 826751744 1 1 -804919168 ... |
| correct output |
|---|
| NO NO NO YES YES ... |
| user output |
|---|
| 1 |
Feedback: Output is shorter than expected
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 200000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 841700673 |
Feedback: Output is shorter than expected
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| 1000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 640753664 |
Feedback: Output is shorter than expected
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| 10000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 333236525 |
Feedback: Output is shorter than expected
Test 15
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 286267582 |
Feedback: Output is shorter than expected
Test 16
Verdict: WRONG ANSWER
| input |
|---|
| 200000 200000 629447384 -729045992 811583872... |
| correct output |
|---|
| NO NO NO NO NO ... |
| user output |
|---|
| 841700673 |
Feedback: Output is shorter than expected
