제출 #1053269

#제출 시각아이디문제언어결과실행 시간메모리
1053269user736482경찰관과 강도 (BOI14_coprobber)C++17
16 / 100
22 ms1804 KiB
#include<bits/stdc++.h> #include<coprobber.h> using namespace std; vector<int> sasiad[507]; int akpos; int licz,wym1,wym2; int n,lastr=-1; int start(int N,bool a[][500]){ n=N; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ if(a[i][j]){ sasiad[i].push_back(j); sasiad[j].push_back(i); licz++; if(i==0) if(j!=1) wym1=j; if(j==n) if(i!=n-1) wym2=n-i; } } } return 0; } int nextMove(int r){ if(licz==n-1){ bool odw[507]; int pop[507]; for(int i=0;i<507;i++) odw[i]=0; odw[akpos]=1; pop[akpos]=akpos; queue<int>q; q.push(akpos); while(!q.empty()){ int pom=q.front(); q.pop(); for(int i=0;i<sasiad[pom].size();i++){ if(!odw[sasiad[pom][i]]){ odw[sasiad[pom][i]]=1; pop[sasiad[pom][i]]=pom; q.push(sasiad[pom][i]); } } } while(pop[r]!=akpos) r=pop[r]; akpos=r; return r; } for(int i=0;i<sasiad[akpos].size();i++){ if(sasiad[akpos][i]==r){ return r; } } for(int i=0;i<sasiad[akpos].size();i++){ if(sasiad[akpos][i]==r+wym1 || sasiad[akpos][i]==r-wym1 || sasiad[akpos][i]==r-wym2 || sasiad[akpos][i]==r+wym2){ akpos=sasiad[akpos][i]; return akpos; } } bool odw[507]; int pop[507]; for(int i=0;i<507;i++) odw[i]=0; odw[akpos]=1; pop[akpos]=akpos; queue<int>q; q.push(akpos); while(!q.empty()){ int pom=q.front(); q.pop(); for(int i=0;i<sasiad[pom].size();i++){ if(!odw[sasiad[pom][i]]){ odw[sasiad[pom][i]]=1; pop[sasiad[pom][i]]=pom; q.push(sasiad[pom][i]); } } } while(pop[r]!=akpos) r=pop[r]; akpos=r; return r; }

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

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:41:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |             for(int i=0;i<sasiad[pom].size();i++){
      |                         ~^~~~~~~~~~~~~~~~~~~
coprobber.cpp:54:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     for(int i=0;i<sasiad[akpos].size();i++){
      |                 ~^~~~~~~~~~~~~~~~~~~~~
coprobber.cpp:59:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |     for(int i=0;i<sasiad[akpos].size();i++){
      |                 ~^~~~~~~~~~~~~~~~~~~~~
coprobber.cpp:76:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |             for(int i=0;i<sasiad[pom].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...