제출 #878788

#제출 시각아이디문제언어결과실행 시간메모리
87878812345678Construction of Highway (JOI18_construction)C++17
7 / 100
2091 ms600 KiB
#include <bits/stdc++.h> using namespace std; const int nx=1e5+5; int n, c[nx], p[nx], u, v; int main() { cin.tie(NULL)->sync_with_stdio(false); p[1]=1; cin>>n; for (int i=1; i<=n; i++) cin>>c[i]; for (int i=1; i<n; i++) { cin>>u>>v; p[v]=u; vector<int> tmp; while (p[u]!=u) tmp.push_back(c[u]), c[u]=c[v], u=p[u]; tmp.push_back(c[1]); c[1]=c[v]; int cnt=0; for (int j=0; j<tmp.size(); j++) for (int k=j+1; k<tmp.size(); k++) if (tmp[k]>tmp[j]) cnt++; cout<<cnt<<'\n'; } }

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

construction.cpp: In function 'int main()':
construction.cpp:23:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for (int j=0; j<tmp.size(); j++) for (int k=j+1; k<tmp.size(); k++) if (tmp[k]>tmp[j]) cnt++;
      |                       ~^~~~~~~~~~~
construction.cpp:23:59: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for (int j=0; j<tmp.size(); j++) for (int k=j+1; k<tmp.size(); k++) if (tmp[k]>tmp[j]) cnt++;
      |                                                          ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...