QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#863165 | #9725. Lottery | IllusionaryDominance# | WA | 1ms | 3712kb | C++20 | 893b | 2025-01-19 13:58:10 | 2025-01-19 13:58:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
using ll = long long;
const int p = 1e9+7;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int T; cin >> T; int ind = 0;
while (T--)
{
cout << "Case #" << (++ind) << ": ";
int n; cin >> n;
vector<pair<ll,ll>> a(n); for (auto &x : a) cin >> x.first >> x.second;
sort(all(a));
ll ans = 1;
for (int i = 0; i < n; ++i)
{
int j = i;
ll sum = a[i].second;
while(j + 1 < n && __lg(sum) >= (a[j+1].first - a[i].first))
{
++j;
sum += a[j].second << (a[j].first - a[i].first);
}
i = j;
ans = (ll)ans * ((sum + 1) % p) % p;
}
cout << ans << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
2 3 1 1 2 1 3 1 3 1 1 2 2 3 3
output:
Case #1: 8 Case #2: 18
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
100 3 14 14 9 12 8 17 3 26 3066725 19 3460487 8 2992323 3 1 13014079 7 11948973 26 4846920 3 9 17117727 7 12599223 1 3986051 3 15 7310145 10 33800431 4 23981598 3 12 6041740 6 48783713 9 49166903 3 6 23123493 13 41855136 3 18453412 3 22 31889237 26 60412072 12 25347349 3 18 47343610 6 15422850 15 25...
output:
Case #1: 630 Case #2: 13622423 Case #3: 424159340 Case #4: 192474401 Case #5: 158386024 Case #6: 828790298 Case #7: 63100320 Case #8: 471306532 Case #9: 802622433 Case #10: 880894712 Case #11: 808199974 Case #12: 745029259 Case #13: 79764776 Case #14: 674457749 Case #15: 292605832 Case #16: 47526282...
result:
ok 100 lines
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3584kb
input:
100 7 2 18 50 19 7 16 8 11 23 10 53 18 33 11 7 50 1498090 41 6906187 28 6959175 48 5209073 58 1594065 1 9282250 25 7108360 7 53 5854804 26 7539508 40 16328548 49 15036483 18 10094218 19 14131838 63 11078670 7 20 6707719 4 29142440 25 23114982 18 25196693 28 20494610 15 19284789 7 7824152 7 39 325876...
output:
Case #1: 16041168 Case #2: 148219634 Case #3: 808687793 Case #4: 133458579 Case #5: 285221747 Case #6: -14066768 Case #7: 201668789 Case #8: 130980850 Case #9: 572099312 Case #10: -870557086 Case #11: -688313004 Case #12: -666570280 Case #13: 114876651 Case #14: 640528873 Case #15: -781996207 Case #...
result:
wrong answer 3rd lines differ - expected: 'Case #3: 37911870', found: 'Case #3: 808687793'