제출 #638591

#제출 시각아이디문제언어결과실행 시간메모리
638591morasha3Alternating Heights (CCO22_day1problem1)C++17
0 / 25
164 ms3788 KiB
#include <bits/stdc++.h> using namespace std; typedef int ll; typedef double ld; const ll mod=1e9+7; #define endl '\n' ll n,k,q,arr[3007],vis[3007],s[3007]; vector<vector<ll>>v(3007); bool f=0; void dfs(ll idx) { vis[idx]=1; s[idx]=1; for(int i=0; i<v[idx].size(); i++) { if(vis[v[idx][i]]&&s[v[idx][i]]) { f=1; break; } else if(vis[v[idx][i]]) continue; dfs(v[idx][i]); } s[idx]=0; } int32_t main() { //freopen("jumping.in","r",stdin); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>k>>q; for(int i=0; i<n; i++) cin>>arr[i]; ll m[n]; for(int i=0;i<n;i++)m[i]=i; for(int h=0;h<2;h++) { for(int i=h,r=i;i<n;i+=2) { ll c=0; while(r<n) { if(c==0) { c++; v[arr[r]-1].push_back(arr[r-1]-1); } else { c=0; v[arr[r-1]-1].push_back(arr[r]-1); } for(int j=0;j<k;j++)vis[j]=0; f=0; for(int j=0;j<k;j++) { if(vis[j]==0) dfs(j); } if(f)break; r++; } m[i]=r; for(int j=0;j<k;j++)v[j].clear(); } } while(q--) { ll a,b; cin>>a>>b; a--,b--; if(m[a]>b) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }

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

Main.cpp: In function 'void dfs(ll)':
Main.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |         for(int i=0; i<v[idx].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...