QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#344934#3805. PromotionsPetroTarnavskyi#Compile Error//C++201.6kb2024-03-05 19:25:272024-03-05 19:25:29

Judging History

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

  • [2024-03-05 19:25:29]
  • 评测
  • [2024-03-05 19:25:27]
  • 提交

answer


vector<LL> solve(string s, int w)
{
	int n = SZ(s);

	VI sa = suffixArray(s);
	VI lcp = lcpArray(s, sa);
	VI rnk(n);
	FOR(i, 0, n)
		rnk[sa[i]] = i;

	
	
	//[start, end)
	map<PII, int> start;
	map<PII, int> end;	
	
	set<PII> poses;
	FOR(i, 0, w)
	{
		poses.insert({rnk[i], i});
	}
	int prev = -1;
	for(auto [rn, i] : poses)
	{
		if(prev != -1)
			start[MP(pre, i)] = 0;
		
		prev = i;
	}
	FOR(i, 1, n - w + 1)
	{
		//remove i - 1
		auto it = poses.find(MP(rnk[i - 1], i - 1));
		assert(it != poses.end());
		int pre = -1;
		int nxt = -1;
		
		if(it != poses.begin())
		{
			pre = prev(it)->S;
			end[MP(pre, i - 1)] = i;
		}
		if(next(it) != poses.end())
		{
			nxt = next(it)->S;
			end[MP(i - 1, nxt)] = i;
		}
		poses.erase(it);
		if(pre != -1 && nxt != -1)
			start[MP(pre, nxt)] = i;
		
		
		
		//add i + w - 1;
		poses.insert(MP(rnk[i + w - 1], i + w - 1));
		
		auto it = poses.find(MP(rnk[i + w - 1], i + w - 1));
		assert(it != poses.end());
		int pre = -1;
		int nxt = -1;
		
		if(it != poses.begin())
		{
			pre = prev(it)->S;
			start[MP(pre, i - 1)] = i;
		}
		if(next(it) != poses.end())
		{
			nxt = next(it)->S;
			start[MP(i - 1, nxt)] = i;
		}
		if(pre != -1 && nxt != -1)
			end[MP(pre, nxt)] = i;
	}
	
	
	prev = -1;
	for(auto [rn, i] : poses)
	{
		
	}
	
	
	
	
}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	string s;
	cin >> s;
	int q, w;
	cin >> q >> w;
	
	auto res = solve(s, w);
	
	while(q--)
	{
		int pos;
		cin >> pos;
		cout << res[pos - 1] << "\n";
	}
	

详细

answer.code:2:8: error: ‘LL’ was not declared in this scope
    2 | vector<LL> solve(string s, int w)
      |        ^~
answer.code:2:8: error: ‘LL’ was not declared in this scope
answer.code:2:8: error: ‘LL’ was not declared in this scope
answer.code:2:8: error: ‘LL’ was not declared in this scope
answer.code:2:8: error: ‘LL’ was not declared in this scope
answer.code:2:8: error: ‘LL’ was not declared in this scope
answer.code:2:8: error: ‘LL’ was not declared in this scope
answer.code:2:8: error: ‘LL’ was not declared in this scope
answer.code:2:8: error: ‘LL’ was not declared in this scope
answer.code:2:1: error: ‘vector’ does not name a type
    2 | vector<LL> solve(string s, int w)
      | ^~~~~~
answer.code: In function ‘int main()’:
answer.code:92:9: error: ‘ios’ has not been declared
   92 |         ios::sync_with_stdio(0);
      |         ^~~
answer.code:93:9: error: ‘cin’ was not declared in this scope
   93 |         cin.tie(0);
      |         ^~~
answer.code:96:9: error: ‘string’ was not declared in this scope
   96 |         string s;
      |         ^~~~~~
answer.code:97:16: error: ‘s’ was not declared in this scope
   97 |         cin >> s;
      |                ^
answer.code:101:20: error: ‘solve’ was not declared in this scope
  101 |         auto res = solve(s, w);
      |                    ^~~~~
answer.code:107:17: error: ‘cout’ was not declared in this scope
  107 |                 cout << res[pos - 1] << "\n";
      |                 ^~~~
answer.code:108:10: error: expected ‘}’ at end of input
  108 |         }
      |          ^
answer.code:91:1: note: to match this ‘{’
   91 | {
      | ^