# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
105729 | 2019-04-14T06:47:45 Z | Pro_ktmr | Fireworks (APIO16_fireworks) | C++14 | 20 ms | 14464 KB |
#include"bits/stdc++.h" using namespace std; #define LL long long #define REP(i, n) for(int (i)=0; (i)<(n); (i)++) #define PB push_back #define MP make_pair #define MOD 1000000007 int N, M; vector<pair<int, LL>> edge[300001]; int par[300001]; vector<pair<LL,int>> chi[300001]; void dfs(int now, int p){ for(int i=0; i<edge[now].size(); i++){ if(edge[now][i].first == p) continue; chi[now].PB(MP(edge[now][i].second, edge[now][i].first)); par[edge[now][i].first] = now; dfs(edge[now][i].first, now); } sort(chi[now].begin(), chi[now].end()); } int main(){ scanf("%d%d", &N, &M); for(int i=0; i<N+M; i++){ int P; LL C; C--; scanf("%d%lld", &P, &C); edge[i].PB(MP(P, C)); edge[P].PB(MP(i, C)); } par[0] = -1; dfs(0, -1); cout << 0 << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 14464 KB | Output is correct |
2 | Incorrect | 20 ms | 14464 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 14464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 14464 KB | Output is correct |
2 | Incorrect | 20 ms | 14464 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 14464 KB | Output is correct |
2 | Incorrect | 20 ms | 14464 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |