# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
875907 |
2023-11-20T17:51:36 Z |
ElenaBM |
Traffic (CEOI11_tra) |
C++17 |
|
5000 ms |
36412 KB |
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
int cont, a, n, m, b;
vector<pair<int,int>>junct;
vector<vector<int>>adj;
void dfs(int nodo, vector<bool>&vis){
//cout<< nodo << ' '<< junct[nodo].y<< '\n';
vis[nodo] = true;
if (junct[nodo].x == a) {
//cerr<< junct[nodo].y;
cont++;
}
for (int i = 0; i < (int)adj[nodo].size(); ++i){
if (!vis[adj[nodo][i]]){
//cerr<< "HI\n";
dfs(adj[nodo][i], vis);
}
}
return;
}
int main()
{
cin>> n>> m>> a>> b;
junct.resize(n);
adj.resize(n);
vector<pair<int,int>>w;
for (int i = 0; i < n; ++i){
cin>> junct[i].x >> junct[i].y;
if (junct[i].x == 0)w.push_back({junct[i].y, i});
}
for (int i = 0; i < m; ++i){
int s, d, f;
cin>> s>> d>> f;
s--;d--;
adj[s].push_back(d);
if (f== 2) adj[d].push_back(s);
}
sort(w.begin(), w.end(), greater());
int ans;
for (int i = 0; i < (int) w.size(); ++i){
cont= 0;
vector<bool>vis(n, false);
dfs(w[i].y,vis);
cout<< cont << '\n';
}
return 0;
}
Compilation message
tra.cpp: In function 'int main()':
tra.cpp:42:9: warning: unused variable 'ans' [-Wunused-variable]
42 | int ans;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
42 ms |
712 KB |
Output is correct |
3 |
Correct |
7 ms |
700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
2392 KB |
Output is correct |
2 |
Execution timed out |
5046 ms |
5332 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
4180 KB |
Output is correct |
2 |
Execution timed out |
5061 ms |
6396 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
98 ms |
7980 KB |
Output is correct |
2 |
Execution timed out |
5009 ms |
11712 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
137 ms |
9608 KB |
Output is correct |
2 |
Execution timed out |
5015 ms |
10452 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
212 ms |
15444 KB |
Output is correct |
2 |
Execution timed out |
5039 ms |
19148 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
368 ms |
24660 KB |
Output is correct |
2 |
Execution timed out |
5023 ms |
29848 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
724 ms |
36412 KB |
Output is correct |
2 |
Execution timed out |
5043 ms |
30616 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
244 ms |
19904 KB |
Output is correct |
2 |
Execution timed out |
5066 ms |
35240 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |