评测机问题吧……求调!
查看原帖
评测机问题吧……求调!
1050431
DevilsFlame楼主2024/2/25 13:26

我下载了 #1数据,发现答案一模一样,却全WA了,QAQ

#include<bits/stdc++.h>
using namespace std;
int n,ans;
string s;
struct No
{
    map < string,int > next;
}tree[50011];
int main()
{
	ios::sync_with_stdio(false);
	scanf("%d",&n);
	for(int i = 1;i <= n;i ++)
	{
		cin >> s;
		int l = 0,r,d = 0;
		for(int j = 1;j <= s.size();j ++)
		{
			if(s[j] == '/' || j == s.size())
			{
				string v = s.substr(l + 1,j - l - 1);
				if(!tree[d].next[v])
                    tree[d].next[v] = d = ++ans;
                else d = tree[d].next[v]; 
				l = j;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}
2024/2/25 13:26
加载中...