QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#741679 | #7028. Renaissance Past in Nancy | SGColin | WA | 1204ms | 82532kb | C++17 | 1.6kb | 2024-11-13 14:59:20 | 2024-11-13 14:59:21 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
inline int rd() {
int x = 0;
bool f = 0;
char c = getchar();
for (; !isdigit(c); c = getchar()) f |= (c == '-');
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
return f ? -x : x;
}
#define eb emplace_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
const int C = 1007;
const int N = 10007;
const int mod = 1000000007;
int testcase, F[N][C], G[N][C];
void add(int &a, int b) {a = (a + b >= mod ? a + b - mod : a + b);}
inline void work() {
printf("Case #%d:\n", ++testcase);
int n = rd(), m = rd();
rep(i, 1, n) {
int a = rd(), b = rd();
int t = (a + 1) * b;
rep(j, 0, 1000) F[i][j] = F[i - 1][j];
if (t <= 1000) rep(j, t, 1000) add(F[i][j], mod - F[i - 1][j - t]);
rep(j, b, 1000) add(F[i][j], F[i][j - b]);
rep(j, 0, 1000) G[i][j] = G[i - 1][j];
rep(j, b, 1000) add(G[i][j], mod - G[i - 1][j - b]);
if (t <= 1000) rep(j, t, 1000) add(G[i][j], G[i][j - t]);
}
rep(i, 0, n) rep(j, 1, 1000) add(G[i][j], G[i][j - 1]);
int lstans = 0;
rep(i, 1, m) {
int l = (rd() + lstans) % n + 1;
int r = (rd() + lstans) % n + 1;
if (l > r) swap(l, r);
int c = rd(), ans = 0;
rep(i, 0, c) ans = (ans + 1ll * F[r][i] * G[l - 1][c - i]) % mod;
printf("%d\n", lstans = ans);
}
}
int main() {
F[0][0] = G[0][0] = 1;
per(t, rd(), 1) work();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 5824kb
input:
1 3 3 1 1 1 2 1 3 1 3 1 1 3 2 1 3 3
output:
Case #1: 2 3 4
result:
ok 4 lines
Test #2:
score: -100
Wrong Answer
time: 1204ms
memory: 82532kb
input:
1000 13 17 24 7 20 6 16 11 3 27 23 7 14 13 18 29 7 9 1 11 4 25 3 25 14 1 31 9 5 7 933 9 9 439 2 9 677 9 12 978 2 6 479 2 4 893 1 9 953 2 7 927 3 4 718 8 12 973 9 12 766 7 8 293 4 8 331 6 11 865 12 13 834 5 12 475 3 8 762 74 47 3 604 3 355 2 738 2 552 2 622 3 198 2 817 14 116 2 659 1 962 1 784 2 669 ...
output:
Case #1: 2280 21 1568333 9600 19200 1428 153600 153600 10 22800 320 68 4800 602566225 525 771665 7312668 Case #2: 347725 587156 575367001 116768706 362120237 6660 207755201 45404417 2178 5847039 3536269 7808316 368563 2083761 894708053 945446607 4769985 4437541 93592 206709086 743190931 8528 1574 21...
result:
wrong answer 20th lines differ - expected: '1926', found: '347725'