# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
852112 | 2023-09-21T08:59:20 Z | Benmath | Paths (BOI18_paths) | C++14 | 832 ms | 1048576 KB |
/****************************************************************************** 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 685 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 832 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 685 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 702 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |