Submission #391761

#TimeUsernameProblemLanguageResultExecution timeMemory
391761ollelPaths (BOI18_paths)C++14
23 / 100
170 ms11000 KiB
#include <bits/stdc++.h> #include <bitset> #include <iostream> using namespace std; typedef vector<int> vi; typedef long long ll; #define rep(i,a,b) for(int i = a; i < b; i++) int n,m,k; vector<vi> adj; vi clr; const int maxN = 200; ll ans = 0; void get(int node, bitset<maxN> &visited, bitset<maxN> &clrs) { ans++; visited.flip(node); clrs.flip(clr[node]); // rep(i,0,10) cout << visited[i] << " "; // cout<<endl; // rep(i,0,10) cout << clrs[i] << " "; // cout << endl; rep(i,0,adj[node].size()) { // cout << visited[adj[node][i]] << " " << clrs[clr[adj[node][i]]] << endl; if ((!visited[adj[node][i]]) && (!clrs[clr[adj[node][i]]])) { get(adj[node][i], visited, clrs); } } visited.flip(node); clrs.flip(clr[node]); } int main() { cin>>n>>m>>k; adj.resize(n); clr.resize(n); rep(i,0,n) cin >> clr[i]; int x,y; rep(i,0,m) { cin>>x>>y;x--;y--; adj[x].push_back(y); adj[y].push_back(x); } bitset<maxN> visited(0), clrs(0); rep(i, 0, n) { get(i, visited, clrs); } ans-=n; cout<<ans<<endl; }

Compilation message (stderr)

paths.cpp: In function 'void get(int, std::bitset<200>&, std::bitset<200>&)':
paths.cpp:9:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | #define rep(i,a,b) for(int i = a; i < b; i++)
......
   27 |   rep(i,0,adj[node].size()) {
      |       ~~~~~~~~~~~~~~~~~~~~           
paths.cpp:27:3: note: in expansion of macro 'rep'
   27 |   rep(i,0,adj[node].size()) {
      |   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...