QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#392207 | #8031. Gitignore | SocialPanda | WA | 1ms | 3872kb | C++14 | 1.5kb | 2024-04-17 11:19:38 | 2024-04-17 11:19:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int,int>
#define pb push_back
#define fi first
#define se second
void solve()
{
vector<vector<int>> v(10000);
map<string,int> rt;
map<pair<string,int>,int> mp;
map<int,int> sn;
int idx=1;
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
string tmp,word;
string father;
cin>>tmp;tmp+='/';
int lv=1;
for(auto z:tmp)
{
if(z=='/')
{
if(mp[{word,lv}]==0) mp[{word,lv}]=idx++;
sn[mp[{word,lv}]]=0;
if(father.empty())
{
rt[word]=1;
}
else
{
v[mp[{father,lv-1}]].pb(mp[{word,lv}]);
}
father=word;
word="";
lv++;
}
else word+=z;
}
}
for(int i=1;i<=m;i++)
{
string tmp,word;
string father;
cin>>tmp;tmp+='/';
int lv=1;
for(auto z:tmp)
{
if(z=='/')
{
if(mp[{word,lv}]==0) mp[{word,lv}]=idx++;
sn[mp[{word,lv}]]=1;
if(father.empty())
{
rt[word]=1;
}
else
{
v[mp[{father,lv-1}]].pb(mp[{word,lv}]);
}
father=word;
word="";
lv++;
}
else word+=z;
}
}
int ans=0;
for(auto z:rt)
{
//cout<<bfs(mp[z.fi])<<' ';
queue<int> q;
q.push(mp[{z.fi,1}]);
while(q.size())
{
int cur=q.front();
q.pop();
if(sn[cur]==0) ans++;
else
{
for(auto z:v[cur])
{
q.push(z);
}
}
}
}
cout<<ans<<endl;
}
int main()
{
int T=1;
cin>>T;
while(T--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3792kb
input:
2 3 0 data/train data/test model 3 1 data/train data/test model data/sample
output:
2 3
result:
ok 2 number(s): "2 3"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
5 0 10 szhps/mb/yz szhps/mb/fb/rf/auw szhps/or/ui hy/xkd/k szhps/mb/fb/rf/mu cf/rnd/wjv/xdda szhps/izh gi szhps/mb/fb/xwe hy/xkd/jbq 0 20 gjy/imp/mxuvi/z/ao gjy/s/zft/jxzm gjy/ob/mwvf/la gjy/imp/supe/oxne/p gjy/ob/mwvf/eums/agfb gjy/imp/mxuvi/z/anaj gjy/ob/mwvf/eums/tv gjy/ob/mwvf/eums/x/gg gjy/s/ak...
output:
0 0 0 0 0
result:
ok 5 number(s): "0 0 0 0 0"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3844kb
input:
6 0 14 evs r/gvzgs/pbs/b/riip r/gvzgs/brps r/gvzgs/pbs/nj r/gvzgs/bl/rhyx/var hg/tdcl r/gvzgs/pbs/fbs/rle r/gvzgs/pt/ncvnc/le/zzpy r/gvzgs/pbs/fbs/xf wux/ts/jxc bo/olh mx/yuw r/gvzgs/pt/ncvnc/le/gxv bo/axyv 2 11 nt/tulqv m/i/i n noqdi/lt m/cim noqdi/jnz m/i/k m/otb m/i/gd nt/ndxv nt/x/hta noqdi/rxbb...
output:
0 4 0 36 5 468
result:
wrong answer 2nd numbers differ - expected: '2', found: '4'