제출 #1078937

#제출 시각아이디문제언어결과실행 시간메모리
1078937Hanksburger9월 (APIO24_september)C++17
45 / 100
104 ms10344 KiB
#include "september.h" #include <bits/stdc++.h> using namespace std; int deg[100005]; set<int> s; int solve(int n, int m, vector<int> p, vector<vector<int> > a) { for (int i=0; i<n; i++) deg[i]=0; for (int i=1; i<n; i++) deg[p[i]]++; int cnt=0; for (int i=0; i<a[0].size(); i++) { int u=a[0][i]; if (!deg[u]) { deg[p[u]]--; while (!deg[p[u]] && s.find(p[u])!=s.end()) { u=p[u]; s.erase(u); deg[p[u]]--; } } else s.insert(u); if (s.empty()) cnt++; } return cnt; }

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

september.cpp: In function 'int solve(int, int, std::vector<int>, std::vector<std::vector<int> >)':
september.cpp:13:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for (int i=0; i<a[0].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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...