제출 #819804

#제출 시각아이디문제언어결과실행 시간메모리
819804Cyber_Wolf친구 (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "friend.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #pragma GCC optimize("Ofast") using namespace std; using namespace __gnu_pbds; #define lg long long #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); const lg N = 2e5+5; lg par[N]; vector<set<lg>> adj(N); lg get(lg src) { if(src == par[src]) return src; return par[src] = get(par[src]); } void join(lg u, lg v) { par[u] = v; return; } int findSample(int n, int c[], int h[], int p[]) { int ans = c[0]; // for(int i = 1; i < n; i++) // { // h[i]++; // } for(int i = 1; i < n; i++) { if(h[i]) ans += c[i]; } for(int i = 1; i < n; i++) { int sum = c[i]; for(int j = i-1; j >= 0; j--) { if(j == h[i]) continue; // cout << j << ' '; sum += c[j]; } for(int j = i+1; j < n; j++) { if(h[j] == i) continue; // cout << j << ' '; sum += c[j]; } // cout << ans << '\n'; ans = max(ans, sum); } return ans; } int main() { fastio; int n; cin >> n; int c[n+1], h[n+1], p[n+1]; for(int i = 0; i < n; i++) { cin >> c[i]; } for(int i = 1; i < n; i++) { cin >> h[i] >> p[i]; } cout << findSample(n, c, h, p) << '\n'; return 0; }

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

/usr/bin/ld: /tmp/ccBdDxP5.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9VLzd4.o:friend.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status