QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#546005#1805. Bunch of Papersurgutti#Compile Error//C++14832b2024-09-03 18:49:552024-09-03 18:49:56

Judging History

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

  • [2024-09-03 18:49:56]
  • 评测
  • [2024-09-03 18:49:55]
  • 提交

answer

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, k;
	cin >> n >> k;
	vector a(n, vector<int>(k));
	for (auto& v : a)
		for (int& x : v)
			cin >> x;

	reverse(a.begin(), a.end());

	const int mod = 1e9 + 7;

	vector<int> dp(k, 1);
	vector<int> last(k, 1e9 + 1);
	
	for (int i = 0; i < n; i++) {
		vector<int> new_dp(k);
		for (int j = 0; j < k; j++) {
			int z = lower_bound(last.begin(), last.end(), a[i][j]) - last.begin();

			// cerr << i << ',' << j << ' ' << a[i][j] << ' ' << z << '\n';
			
			if (z >= k)
				new_dp[j] = 0;
			else
				new_dp[j] = dp[z];
		}

		last = a[i];
		for (int j = k - 2; j >= 0; j--)
			(new_dp[j] += new_dp[j + 1]) %= mod;

		dp.swap(new_dp);
	}

	cout << dp[0] << '\n';

	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:10:16: error: missing template arguments before ‘a’
   10 |         vector a(n, vector<int>(k));
      |                ^
answer.code:11:24: error: ‘a’ was not declared in this scope
   11 |         for (auto& v : a)
      |                        ^
answer.code:15:17: error: ‘a’ was not declared in this scope
   15 |         reverse(a.begin(), a.end());
      |                 ^