제출 #567288

#제출 시각아이디문제언어결과실행 시간메모리
567288almothana05Bitaro’s Party (JOI18_bitaro)C++14
0 / 100
4 ms5076 KiB
#include<bits/stdc++.h> #define mod 1000000007 #define inf 100000000000000000 using namespace std; int dis[200000] , ind[200000] , vis[200000]; vector<int>fater[200000]; queue<int>q; unordered_map<int , int>trans; void dfs(int x){ vis[x] = 1; for(int i = 0 ; i < fater[x].size() ; i++){ int fa = fater[x][i]; ind[fa]++; if(vis[fa] == 0){ dfs(fa); } } } 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; dfs(numm); q.push(numm); while(q.size()){ int jet = q.front(); q.pop(); // cout << jet << ' '; 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); } } } // cout << "\n"; // 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"; }

컴파일 시 표준 에러 (stderr) 메시지

bitaro.cpp: In function 'void dfs(int)':
bitaro.cpp:11:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |    for(int i = 0 ; i < fater[x].size() ; i++){
      |                    ~~^~~~~~~~~~~~~~~~~
bitaro.cpp: In function 'int main()':
bitaro.cpp:37:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |      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...