UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#215033#2410. 图案STASISZHYCompile Error//C++111.2kb2024-11-25 20:30:582024-11-25 23:09:24

answer

// Problem: B. 图案
// Contest: undefined - NOIP2024训练赛 13
// URL: http://noi.ac/contest/1165/problem/2410
// Memory Limit: 1024 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

// Problem: P3375 【模板】KMP
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P3375
// Memory Limit: 512 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
//#define int long long
#define fi first
#define se second
#define PII pair<int, int>

using namespace std;

const int N = 2e6 + 10, M = 1e6 + 10, mod = 1e9 + 7, INF = 0x3f3f3f3f;

int n, m, q, cnt, nxt[N], ans[N];
string s;

vector<int> e[N];

signed main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> m;
	cin >> s; s = ' ' + s;`
	nxt[1] = 0;
	for(int i = 2, j = nxt[i - 1]; i <= n; i ++)
	{
		while(j && s[i] != s[j + 1]) j = nxt[j];
		if(s[i] == s[j + 1]) j ++;
		nxt[i] = j;
	}
	// for(int i = 1; i <= len2; i ++) cout << nxt[i] << ' ';
	for(int i = 1; i <= n; i ++)
	{
		int now = i - nxt[i], l = i / now;
		if(i % now) cout << ((l / m - l % m) > 0);
		else cout << ((l / m - l % m) >= 0);
	}
	return 0;
}

详细

answer.code:36:2: error: stray '`' in program
  cin >> s; s = ' ' + s;`\x0d
  ^