Submission #852112

#TimeUsernameProblemLanguageResultExecution timeMemory
852112BenmathPaths (BOI18_paths)C++14
0 / 100
832 ms1048576 KiB
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; long long int brojac = 0; int n; int m; int k; int boja[10]; int koja_boja[300005]; vector<int>adjl[300005]; void dfs(int s){ // cout << s << endl; boja[s]++; brojac++; for (int i = 0; i < adjl[s].size(); i++){ if(boja[koja_boja[adjl[s][i]]] == 0){ dfs(adjl[s][i]); boja[koja_boja[adjl[s][i]]] = 0; } } } int main() { cin >> n >> m >> k; for(int i = 1; i <= n; i++){ cin >> koja_boja[i]; } for (int i = 0; i < m; i++){ int x, y; cin >> x >> y; adjl[x].push_back(y); adjl[y].push_back(x); } for (int i = 1; i <= n; i++){ for (int j = 1; j <= k; j++){ boja[j] = 0; } dfs(i); brojac--; } cout << brojac; }

Compilation message (stderr)

paths.cpp: In function 'void dfs(int)':
paths.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < adjl[s].size(); i++){
      |                     ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...