QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#821493#9220. Bus AnalysisHildaHuWA 5ms21260kbC++141.1kb2024-12-19 16:15:082024-12-19 16:15:13

Judging History

你现在查看的是最新测评结果

  • [2024-12-19 16:15:13]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:21260kb
  • [2024-12-19 16:15:08]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 1010, M = 80, mod = 1e9 + 7;
int n, ans, a[N], pw[N], f[N][M][M];
void add(int &x, int y) {x = (x + y) % mod; }
int work(int x, int y) {
	return (!x || x + y > 75) ? 0 : x + y;
}

signed main() {
	cin >> n;
	pw[0] = 1;
	for (int i=1; i<=n; ++i) pw[i] = pw[i - 1] * 2 % mod;
	for (int i=1; i<=n; ++i) cin >> a[i];
	f[0][0][0] = 1;
	for (int i=0; i<n; ++i)
		for (int j=0; j<=min(75ll,i); ++j) {
			int nxt = a[i + 1] + 19;
			if (j && nxt < a[i - j + 1] + 74) nxt = a[i - j + 1] + 74;
			nxt = upper_bound(a + 1, a + n + 1, nxt) - a - 1;
			for (int k=0; k<=min(75ll,i); ++k) if (f[i][k][j]) {
				//printf("%d %d %d = %d, nxt %d\n", i, k, j, f[i][k][j], nxt);
				add(f[nxt][work(k, nxt - i)][work(j, nxt - i)], f[i][k][j]);
				add(f[nxt][nxt - i][work(k, nxt - i)], f[i][k][j] * (pw[nxt - i] - 1));
				//printf("add %d %d %d, %d\n", nxt, nxt - i, work(k, nxt - i), f[i][k][j] * (pw[nxt - i] - 1));
				add(ans, f[i][k][j] * (pw[nxt - i] - 1) % mod * pw[n - nxt]);
			}
		}
	cout << ans * 2 << "\n";
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3692kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: -100
Wrong Answer
time: 5ms
memory: 21260kb

input:

1000
2 7 9 12 14 17 18 21 22 28 29 33 34 35 37 38 44 45 46 50 58 59 63 66 71 72 75 76 77 78 80 81 83 84 87 92 100 101 107 108 109 112 114 116 118 123 124 131 142 143 144 145 148 150 151 152 153 155 157 158 165 167 168 169 171 176 182 185 190 192 198 202 204 205 212 213 223 224 225 226 229 231 240 24...

output:

615048600

result:

wrong answer 1st numbers differ - expected: '932594593', found: '615048600'