Submission #875451

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8754512023-11-19 18:12:25lalig777Traffic (CEOI11_tra)C++14
32 / 100
5099 ms37324 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
void dfs(int nodo, int &count, vector<bool> &visitado, vector<bool> &east, vector<vector<int> > &listaAdy){
visitado[nodo]=true;
if (east[nodo]==true) count++;
for (int j=0; j<listaAdy[nodo].size(); j++){
int conexion=listaAdy[nodo][j];
if (visitado[conexion]!=true) dfs(conexion, count, visitado, east, listaAdy);
}return;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n, m, A, B;
cin>>n>>m>>A>>B;
vector<pair<int, int> >west;
vector<bool>east(n, false);
int x, y;
for (int i=0; i<n; i++){
cin>>x>>y;
if (x==0) west.push_back(make_pair(y, i));
else if (x==A) east[i]=true;
}sort(west.begin(), west.end());
reverse(west.begin(), west.end());
vector<vector<int> >listaAdy(n);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

tra.cpp: In function 'void dfs(int, int&, std::vector<bool>&, std::vector<bool>&, std::vector<std::vector<int> >&)':
tra.cpp:10:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for (int j=0; j<listaAdy[nodo].size(); j++){
      |                ~^~~~~~~~~~~~~~~~~~~~~~
tra.cpp: In function 'int main()':
tra.cpp:37:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for (int i=0; i<west.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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...