제출 #994688

#제출 시각아이디문제언어결과실행 시간메모리
994688PenguinsAreCuteJobs (BOI24_jobs)C++17
11 / 100
158 ms21588 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int MAXN = 314159; int pr[MAXN]; vector<int> adj[MAXN]; int dfs(int x) { int ans = pr[x]; for(auto i: adj[x]) ans += dfs(i); return max(0LL,ans); } main() { int n, s; cin >> n >> s; for(int i=1,p;i<=n;i++) {cin>>pr[i]>>p; adj[p].push_back(i);} cout << dfs(0); }

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

Main.cpp:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   12 | main() {
      | ^~~~
#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...