QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#545922 | #8031. Gitignore | DING | Compile Error | / | / | C++14 | 2.6kb | 2024-09-03 18:13:19 | 2024-09-03 18:13:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
const int N=1e3+7;
int n,m;
int mm=0;
map<string,int>ac;
int sw(string s){
mm++;
ac[s]=mm;
return mm;
}
struct st{
int u;
int v;
st(int _v):v(_v){}
};
vector<st>e[1005];
int mp[N];
int mp1[N];
int cc[N];
int a[N];
void add_s(int s1,int s2){
if(!mp[s1*10+s2])
e[s1].push_back((s2)),mp[s1*10+s2]=1;
}
int cnt;
int dfs(int beg){
int sum=0;
for(int j=0;j<e[beg].size();j++){
if(!mp1[e[beg][j].v]){
sum++;
mp1[e[beg][j].v]=1;
continue;
}
else{
sum+=dfs(e[beg][j].v);
}
}
return sum;
}
void solve(){
int ans=0;
cin>>n>>m;
for(int i=1;i<=n;i++){
string str;
cin>>str;
string s0;
int s1;
int fl=0;
int len=str.length();
str+='/';
for(int j=0;j<=len;j++){
if(str[j]!='/'){
s0+=str[j];
}
else{
int ssw;
if(!ac[s0])
ssw=sw(s0);
else ssw=ac[s0];
if(fl==0){
s1=ssw;
if(!cc[s1])
a[cnt++]=s1,cc[s1]=1;
fl=1;
}
else{
add_s(s1,ssw);
s1=ssw;
}
s0.clear();
}
}
}
for(int i=1;i<=m;i++){
string str;cin>>str;
int len=str.length();
str+='/';
string s0;
for(int j=0;j<=len;j++){
if(str[j]!='/'){
s0+=str[j];
}
else{
int ssw;
if(!ac[s0])ssw=sw(s0);
else ssw=ac[s0];
mp1[ssw]=1;
s0.clear();
}
}
}
for(int i=0;i<cnt;i++){
if(!mp1[a[i]]){
ans++;
mp1[a[i]]=1;
}
else{
ans+=dfs(a[i]);
}
}
cout<<ans<<endl;
}
signed main(){
fast;
int t=1;
cin>>t;
while(t--){
mm=0;
e.clear();
memset(mp,0,sizeof(mp));
memset(mp1,0,sizeof(mp1));
memset(a,0,sizeof(a));
memset(cc,0,sizeof(cc));
ac.clear();
cnt=0;
solve();
}
}
Details
answer.code: In function ‘int main()’: answer.code:120:11: error: request for member ‘clear’ in ‘e’, which is of non-class type ‘std::vector<st> [1005]’ 120 | e.clear(); | ^~~~~