QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#472440#8866. Drying LaundryPetroTarnavskyi#Compile Error//C++201.5kb2024-07-11 16:27:162024-07-11 16:27:17

Judging History

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

  • [2024-07-11 16:27:17]
  • 评测
  • [2024-07-11 16:27:16]
  • 提交

answer

//#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

const int L = 300747;

struct Sheet
{
	int d, tFast, tSlow;
};

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, q;
	cin >> n >> q;
	vector<Sheet> sheets(n);
	LL s = 0;
	for (Sheet& sheet : sheets)
	{
		cin >> sheet.d >> sheet.tFast >> sheet.tSlow;
		s += sheet.d;
	}
	sort(ALL(sheets), [](const Sheet& x, const Sheet& y)
	{
		return x.tSlow < y.tSlow;
	});
	VI maxSufFast(n);
	RFOR(i, n, 0)
	{
		maxSufFast[i] = sheets[i].tFast;
		if (i + 1 < n)
			maxSufFast[i] = max(maxSufFast[i], maxSufFast[i + 1]);
	}
	bitset<L> knapsack;
	knapsack[0] = 1;
	LL p = 0;
	int ptr = 0;
	VI ans(L, -1);
	RFOR(l, L, 1)
	{
		while (ptr < n && s - l < L && (LL)knapsack._Find_next(max(0LL, s - l)) > l - s + p)
		{
			knapsack |= knapsack << sheets[ptr].d;
			p += sheets[ptr].d;
			ptr++;
		}
		if (ptr == n && s - l < L && (LL)knapsack._Find_next(max(0LL, s - l)) > l - s + p)
		{
			break;
		}
		ans[l] = max(ptr == 0 ? 0 : sheets[ptr - 1].tSlow, ptr == n ? 0 : maxSufFast[ptr]);
	}
	while (q--)
	{
		int l;
		cin >> l;
		cout << ans[l] << "\n";
	}
	return 0;
}


詳細信息

answer.code:15:9: error: ‘vector’ does not name a type
   15 | typedef vector<int> VI;
      |         ^~~~~~
answer.code:16:9: error: ‘pair’ does not name a type
   16 | typedef pair<int, int> PII;
      |         ^~~~
answer.code: In function ‘int main()’:
answer.code:28:9: error: ‘ios’ has not been declared
   28 |         ios::sync_with_stdio(0);
      |         ^~~
answer.code:29:9: error: ‘cin’ was not declared in this scope
   29 |         cin.tie(0);
      |         ^~~
answer.code:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
  +++ |+#include <iostream>
    1 | //#include <bits/stdc++.h>
answer.code:32:9: error: ‘vector’ was not declared in this scope
   32 |         vector<Sheet> sheets(n);
      |         ^~~~~~
answer.code:1:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
  +++ |+#include <vector>
    1 | //#include <bits/stdc++.h>
answer.code:32:21: error: expected primary-expression before ‘>’ token
   32 |         vector<Sheet> sheets(n);
      |                     ^
answer.code:32:23: error: ‘sheets’ was not declared in this scope; did you mean ‘Sheet’?
   32 |         vector<Sheet> sheets(n);
      |                       ^~~~~~
      |                       Sheet
answer.code:39:9: error: ‘sort’ was not declared in this scope; did you mean ‘short’?
   39 |         sort(ALL(sheets), [](const Sheet& x, const Sheet& y)
      |         ^~~~
      |         short
answer.code:43:9: error: ‘VI’ was not declared in this scope
   43 |         VI maxSufFast(n);
      |         ^~
answer.code:46:17: error: ‘maxSufFast’ was not declared in this scope
   46 |                 maxSufFast[i] = sheets[i].tFast;
      |                 ^~~~~~~~~~
answer.code:48:41: error: ‘max’ was not declared in this scope
   48 |                         maxSufFast[i] = max(maxSufFast[i], maxSufFast[i + 1]);
      |                                         ^~~
answer.code:50:9: error: ‘bitset’ was not declared in this scope
   50 |         bitset<L> knapsack;
      |         ^~~~~~
answer.code:1:1: note: ‘std::bitset’ is defined in header ‘<bitset>’; did you forget to ‘#include <bitset>’?
  +++ |+#include <bitset>
    1 | //#include <bits/stdc++.h>
answer.code:50:19: error: ‘knapsack’ was not declared in this scope
   50 |         bitset<L> knapsack;
      |                   ^~~~~~~~
answer.code:54:11: error: expected ‘;’ before ‘ans’
   54 |         VI ans(L, -1);
      |           ^~~~
      |           ;
answer.code:57:72: error: ‘max’ was not declared in this scope
   57 |                 while (ptr < n && s - l < L && (LL)knapsack._Find_next(max(0LL, s - l)) > l - s + p)
      |                                                                        ^~~
answer.code:63:70: error: ‘max’ was not declared in this scope
   63 |                 if (ptr == n && s - l < L && (LL)knapsack._Find_next(max(0LL, s - l)) > l - s + p)
      |                                                                      ^~~
answer.code:67:17: error: ‘ans’ was not declared in this scope
   67 |                 ans[l] = max(ptr == 0 ? 0 : sheets[ptr - 1].tSlow, ptr == n ? 0 : maxSufFast[ptr]);
      |                 ^~~
answer.code:67:83: error: ‘maxSufFast’ was not declared in this scope
   67 |                 ans[l] = max(ptr == 0 ? 0 : sheets[ptr - 1].tSlow, ptr == n ? 0 : maxSufFast[ptr]);
      |                                                                                   ^~~~~~~~~~
answer.code:67:26: error: ‘max’ was not declared in this scope
   67 |                 ans[l] = max(ptr == 0 ? 0 : sheets[ptr - 1].tSlow, ptr == n ? 0 : maxSufFast[ptr]);
      |                          ^~~
answer.code:73:17: error: ‘cout’ was not declared in this scope
   73 |                 cout << ans[l] << "\n";
      |                 ^~~~
answer.code:73:17: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:73:25: error: ‘ans’ was not declared in this scope
   73 |                 cout << ans[l] << "\n";
      |                         ^~~