UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#213973#2739. 阿空的核聚变one_zero_four_zeroCompile Error//C++111.2kb2024-11-14 20:40:332024-11-14 23:06:20

answer

#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

string s;
int N, Q, P = 1, nowpos = 1;
int l, r;
int t[500005][28]; // trie
int fa[15000007], las[15000007];
char ch[15000007];
vector<pair<int, int> > it;

void __init(){
	for (int i = 1; i <= N; i ++){
		char tmp = s[i];
		while (ch[nowpos] == tmp){
			nowpos = fa[nowpos];
			tmp ++;
			if (tmp > 'z') break;
		}
		if (tmp <= 'z'){
			if (t[nowpos][tmp - 'a']){
				nowpos = t[nowpos][tmp - 'a'];
			}else{
				t[nowpos][tmp - 'a'] = ++ P;
				fa[P] = nowpos;
				ch[P] = tmp;
				nowpos = P;
				las[nowpos] = i;
			}
		}
		if (las[nowpos] != i) it.push_back({las[nowpos] + 1, i});
		las[nowpos] = i;
		cout << "-----------" << i << "------------------\n";
		cout << nowpos << " " << fa[nowpos] << " " << ch[nowpos] << ";;\n";
	}
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("../data.in", "r", stdin);
    freopen("../data.out", "w", stdout);
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s;
	N = s.size();
	s = "0" + s;
	__init();
	for (auto && i : it){
		cout << i.first << "::" << i.second << "\n";
	}
	cin >> Q;
	while (Q --){
		cin >> l >> r;
		solve(l, r);
	}

    return 0;
}

Details

answer.code: In function 'int main()':
answer.code:57:13: error: 'solve' was not declared in this scope
   solve(l, r);\x0d
             ^