Submission #567268

#TimeUsernameProblemLanguageResultExecution timeMemory
567268almothana05Bitaro’s Party (JOI18_bitaro)C++14
0 / 100
4 ms4948 KiB
#include<bits/stdc++.h>
#define mod 1000000007
#define inf 100000000000000000
using namespace std;
int dis[200000] , ind[200000];
vector<int>fater[200000];
queue<int>q;
unordered_map<int , int>trans;
int main(){
   // ios_base::sync_with_stdio(false);
   // cin.tie(NULL);
  int menge , numm , nummer , ed , que;
  cin >> menge >> ed >> que;
  for(int i = 0 ; i < ed ; i++){
     cin >> numm >> nummer;
     fater[nummer].push_back(numm);
     ind[numm]++;
  }
  cin >> numm;
  for(int i = menge; i > numm ; i-- ){
     for(int j = 0 ; j < fater[i].size() ; j++){
        ind[fater[i][j]]--;
     }
  }
  q.push(numm);
  while(q.size()){
     int jet = q.front();
     q.pop();
     for(int i = 0 ; i < fater[jet].size() ; i++){
        int fa = fater[jet][i];
        ind[fa]--;
        dis[fa] = max(dis[fa] , dis[jet] + 1);
        if(ind[fa] == 0){
           q.push(fa);
        }
     }
  }
//   for(int i = 0 ; i <= menge ; i++){
//      cout << dis[i] << ' ';
//   }
//   cout << "\n";
  int erg = -1;
  cin >> nummer;
  for(int i = 0 ; i < nummer ; i++){
     cin >> ed;
     trans[ed] = 1;
  }
  for(int i = numm ; i >= 1 ; i--){
     if(trans[i] != 1){
        erg = max(erg , dis[i]);
     }
  }
  cout << erg << "\n";
}


Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:21:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |      for(int j = 0 ; j < fater[i].size() ; j++){
      |                      ~~^~~~~~~~~~~~~~~~~
bitaro.cpp:29:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |      for(int i = 0 ; i < fater[jet].size() ; i++){
      |                      ~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...