QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#177376#7118. Closing Timetriple321#Compile Error//C++201.8kb2023-09-12 21:55:372024-04-28 07:39:35

Judging History

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

  • [2024-04-28 07:39:35]
  • 管理员手动重测本题所有提交记录
  • [2023-09-12 21:55:38]
  • 评测
  • [2023-09-12 21:55:37]
  • 提交

answer

#include <bits/stdc++.h>
#include "closing.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")

using namespace std;
using namespace __gnu_pbds;

#define lg long long
#define ordered_set	tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int max_score(int n, int x, int y, lg k, int u[], int v[], int w[])
{
	int ans = 0;
	x++, y++;
	lg a[n+2], b[n+2], c[n+2], d[n+2];
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	memset(c, 0, sizeof(c));
	memset(d, 0, sizeof(d));
	for(int i = x-1; i >= 1; i--)
	{
		a[i] = a[i+1]+w[i-1];
	}
	for(int i = y-1; i >= 1; i--)
	{
		c[i] = c[i+1]+w[i-1];
	}
	for(int i = x+1; i <= n; i++)
	{
		b[i] = b[i-1]+w[i-2];
	}
	for(int i = y+1; i <= n; i++)
	{
		d[i] = d[i-1]+w[i-2];
	}
	lg sum = 0;
	vector<lg> mxm(n+2);
	for(int i = x; i >= 1; i--)
	{
		sum += max(0ll, a[i]-mxm[i]);
		mxm[i] = max(mxm[i], a[i]);
		vector<lg> fake3 = mxm;
		lg o3 = sum;
		for(int j = x; j <= n; j++)
		{
			sum += max(0ll, b[j]-mxm[j]);
			mxm[j] = max(mxm[j], a[j]);
			vector<lg> fake2 = mxm;
			lg o2 = sum;
			for(int z = y; z >= 1; z--)
			{
				sum += max(0ll, c[z]-mxm[z]);
				mxm[z] = max(mxm[z], c[z]);
				vector<lg> fake = mxm;
				lg o = sum;
				for(int g = y; g <= n; g++)
				{
					sum += max(0ll, d[g]-mxm[g]);
					mxm[g] = max(mxm[g], d[g]);
					// cout << i << ' ' << j << ' ' << z << ' ' << g << '\n';
					// for(int i = 1; i <= n; i++)	cout << mxm[i] << ' ';
					// cout << '\n';
					if(sum <= k)	
					{
						ans = max(ans, (j-i+1)+(g-z+1));
					}
				}
				sum = o;
				mxm = fake;
			}
			mxm = fake2;
			sum = o2;
		}
		mxm = fake3;
		sum = o3;
	}
	return ans;
}


Details

/usr/bin/ld: /tmp/ccN5FQfn.o: in function `main':
implementer.cpp:(.text.startup+0x6d4): undefined reference to `max_score(int, int, int, long long, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status