QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#645605#9220. Bus Analysisucup-team2432WA 1810ms24428kbC++173.6kb2024-10-16 19:09:442024-10-16 19:09:44

Judging History

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

  • [2024-10-16 19:09:44]
  • 评测
  • 测评结果:WA
  • 用时:1810ms
  • 内存:24428kb
  • [2024-10-16 19:09:44]
  • 提交

answer

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define ll long long
#define all(v) v.begin(),v.end()
#define sz(v) ((ll)v.size())
#define V vector
#define vi V<int>
#define vll V<ll>
#define eb emplace_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define A array
#define pb push_back
#define mset multiset
#define gpumap __gnu_pbds::gp_hash_table
#define ccumap __gnu_pbds::cc_hash_table
#define ui unsigned int
#define ull unsigned ll
#define i128 __int128
#define cerr if (test) cerr
#define freopen if (test) freopen
#define whtest if (test)
using namespace std;

constexpr int test = 0;

namespace jhsy {
	constexpr int B = 75,P = 1e9+7;
	struct Info {
		ll c{},s{};
		Info() {}
		Info(ll c,ll s):c(c),s(s) {}
		Info friend operator + (const Info &x,const Info &y) {
			return {(x.c+y.c)%P,(x.s+y.s)%P};
		}
		Info add(int k) const {
			return {c,s+k*c%P};
		}
	};
	void main() {
		int n;
		cin >> n;
		A<A<A<A<int,4>,B+1>,B+1>,B+1> p{};
		for (int x = 0; x <= B; x++) {
			for (int y = x; y <= B; y++) {
				for (int z = y; z <= B; z++) {
					vi f(B+1);
					for (int i = 0; i <= x; i++) {
						f[i] = 0;
					}
					for (int i = x+1; i <= y; i++) {
						f[i] = 1;
					}
					for (int i = y+1; i <= z; i++) {
						f[i] = 2;
					}
					f[B] = min(f[B-20]+1,f[B-75]+3);
					p[x][y][z][3] = f[1];
					vi vec;
					for (int i = 1; i+1 <= B; i++) {
						if (f[i] != f[i+1]) {
							vec.eb(i-1);
						}
					}
					vec.resize(3,B);
					for (int i = 0; i < 3; i++) {
						p[x][y][z][i] = vec[i];
					}
				}
			}
		}
		A<A<A<Info,B+1>,B+1>,B+1> f{};
		f[B][B][B] = {1,0};
		auto mv = [&](int i,int j,int k,int x) -> A<int,4> {
			A<int,4> res{}; int c = 0;
			for (int o = 0; o < 3; o++) {
				res[o] = B;
			}
			if (i != B) {
				if (i >= x) {
					res[0-c] = i-x;
				}
				else {
					c++;
				}
			}
			if (j != B) {
				if (j >= x) {
					res[1-c] = j-x;
				}
				else {
					c++;
				}
			}
			if (k != B) {
				if (k >= x) {
					res[2-c] = k-x;
				}
				else {
					c++;
				}
			}
			res[3] = c;
			return res;
		};
		for (int o = 0,lst = 0; o < n; o++) {
			int cur;
			cin >> cur;
			int x = cur-lst;
			{
				decltype(f) g{};
				for (int i = 0; i <= B; i++) {
					for (int j = i; j <= B; j++) {
						for (int k = j; k <= B; k++) {
							if (f[i][j][k].c || f[i][j][k].s) {
								auto [a,b,c,d] = mv(i,j,k,x-1);
								g[a][b][c] = g[a][b][c]+f[i][j][k].add(d);
							}
						}
					}
				}
				f = std::move(g);
			}
			{
				decltype(f) g{};
				for (int i = 0; i <= B; i++) {
					for (int j = i; j <= B; j++) {
						for (int k = j; k <= B; k++) {
							if (f[i][j][k].c || f[i][j][k].s) {
								{
									auto [a,b,c,d] = mv(i,j,k,1);
									g[a][b][c] = g[a][b][c]+f[i][j][k].add(d);
								}
								{
									auto [a,b,c,d] = p[i][j][k];
									g[a][b][c] = g[a][b][c]+f[i][j][k].add(d);
								}
							}
						}
					}
				}
				f = std::move(g);
			}
			lst = cur;
		}
		ll ans = 0,cnt = 0;
		for (int i = 0; i <= B; i++) {
			for (int j = 0; j <= B; j++) {
				for (int k = 0; k <= B; k++) {
					auto [a,b,c,d] = mv(i,j,k,B);
					ans = (ans+f[i][j][k].add(d).s)%P;
				}
			}
		}
		ans = (2*ans)%P;
		cout << ans << '\n';
	}
}

int main() {
	freopen("test.in","r",stdin);
	freopen("test.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(20);

//	jhsy::init();

	int T = 1;
//	cin >> T;
	while (T--) {
		jhsy::main();
	}

	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 23ms
memory: 24428kb

input:

3
1 8 20

output:

14

result:

ok 1 number(s): "14"

Test #2:

score: 0
Accepted
time: 23ms
memory: 24132kb

input:

5
25 45 65 85 1000000000

output:

156

result:

ok 1 number(s): "156"

Test #3:

score: -100
Wrong Answer
time: 1810ms
memory: 24140kb

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:

979954629

result:

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