QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#309436#8031. GitignoreEbiarat#Compile Error//C++142.7kb2024-01-20 17:20:462024-01-20 17:20:47

Judging History

你现在查看的是最新测评结果

  • [2024-01-20 17:20:47]
  • 评测
  • [2024-01-20 17:20:46]
  • 提交

answer

#include <iostream>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
#include <sstream>
#include <ctime>
#include <iterator>
#include <string.h>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <fstream>
#include <assert.h>
#include <numeric>
#include <complex>
#include <random>
#include <utility>
#define IOS ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a) - 1; i>=(b);i--)
#define rep(i,n) FOR(i,0,n)
#define PB push_back
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define VI vector<int>
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define VL vector<long long >
#define FILL(a, value) memset(a, value, sizeof(a))
const int nax = (int)4e5 + 147;
 
using namespace std;
 
const int MOD = (int)1e9 + 7;
const int INF = 1e9 +47 ;
const long long LINF = (long long)1e18 + 4747;
 
typedef long long LL;

map<string,vector<string >> g;
map<string,bool> ignored;
map<string,int > ign_cnt;
map<string,int > sz;
map<string,int > ans;
map<pair<string,string>,bool> edge;
map<string,int> is_vertex;
void dfs(string v)
{
    sz[v] = is_vertex[v];
    ign_cnt[v] = ignored[v];
    for(auto to : g[v])
    {
        dfs(to);
        sz[v]+=sz[to];
        ign_cnt[v]+=ign_cnt[to];
    }
    if(ign_cnt[v] == sz[v] && v!="ROOT")ans[v] = 1;
    else {
        for(auto to : g[v])ans[v]+=ans[to];
        if(ignored[v])ans[v]++;
    }
 }
void solve()
{
    int n,m;
    cin >> n >> m;
    for(int j = 0;j <n + m ;j ++ )
    {
        string s;
        cin >> s;
        string prev = "ROOT";
        int id = 0;
        while(true) {
           string cur = "";
            while(id < s.size() && s[id]!='/'  )
            {
                cur+=s[id];
                id++;
            }
            if(!edge.contains({prev,cur})){
                g[prev].push_back(cur);
                edge[{prev,cur}] = true;
            }
            
            if(id == s.size())is_vertex[cur] = true;
            if(j < n && id == s.size()){
                ignored[cur] = true;
            }
            prev = cur ;
            id++;
            if(id >=s.size())break;
        }
    }
    dfs("ROOT");
    cout << ans["ROOT"] << '\n';
    g.clear();
    ignored.clear();
    ign_cnt.clear();
    ans.clear();
    edge.clear();
    is_vertex.clear();
    sz.clear();
}
int main() {
    IOS;
    int tt = 1;
     cin >> tt;
    while(tt--)
    {
        solve();
    }
}




Details

answer.code: In function ‘void solve()’:
answer.code:86:22: error: ‘class std::map<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >, bool>’ has no member named ‘contains’
   86 |             if(!edge.contains({prev,cur})){
      |                      ^~~~~~~~