# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1103658 | 2024-10-21T13:28:55 Z | Ahmed57 | 트리 (IOI24_tree) | C++17 | 57 ms | 8488 KB |
#include <bits/stdc++.h> using namespace std; long long cnt = 0; bool nah = 0; void init(std::vector<int> P, std::vector<int> W){ int deg[P.size()] = {0}; if(P.size()==1){ nah = 1; } int root = -1; for(int i = 0;i<P.size();i++){ int x = P[i]; if(x==-1){ root = i; }else{ deg[x]++; deg[i]++; } } for(int i = 0;i<P.size();i++){ if(i==root)continue; if(deg[i]==1)cnt++; } } long long query(int L, int R){ if(nah)return L; return cnt*L+max(0ll,(cnt*L-R)); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 6704 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 8476 KB | Output is correct |
2 | Correct | 57 ms | 8352 KB | Output is correct |
3 | Correct | 49 ms | 8352 KB | Output is correct |
4 | Correct | 51 ms | 8332 KB | Output is correct |
5 | Correct | 52 ms | 8488 KB | Output is correct |
6 | Correct | 48 ms | 8232 KB | Output is correct |
7 | Correct | 52 ms | 8352 KB | Output is correct |
8 | Correct | 47 ms | 7468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 8476 KB | Output is correct |
2 | Correct | 57 ms | 8352 KB | Output is correct |
3 | Correct | 49 ms | 8352 KB | Output is correct |
4 | Correct | 51 ms | 8332 KB | Output is correct |
5 | Correct | 52 ms | 8488 KB | Output is correct |
6 | Correct | 48 ms | 8232 KB | Output is correct |
7 | Correct | 52 ms | 8352 KB | Output is correct |
8 | Correct | 47 ms | 7468 KB | Output is correct |
9 | Incorrect | 51 ms | 8352 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 6988 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Incorrect | 33 ms | 6704 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |