답안 #1103418

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1103418 2024-10-21T00:00:08 Z aaaaaarroz 트리 (IOI24_tree) C++17
7 / 100
62 ms 10060 KB
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for(int i = 0, i##__n = (int)(n); i < i##__n; ++i)
#define fer(i, a, b) for(int i = (int)(a), i##__b = (int)(b); i < i##__b; ++i)
#define rof(i, b, a) for(int i = (int)(b), i##__a = (int)(a); i-- > i##__a; )
#define sz(x) (int((x).size()))
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
//#define endl '\n'
 
template<class P, class Q> inline void smin(P &a, Q b) { if (b < a) a = b; }
template<class P, class Q> inline void smax(P &a, Q b) { if (a < b) a = b; }
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
 
////////////////////////////////////////////////////////////////////////////////
 
const int maxn = 300'000 + 100;
 
int n;
vector<int> p, w;
int cnt[maxn];
int leaves_cnt;
 
void init(vector<int> _p, vector<int> _w) {
	p = _p, w = _w;
	n = sz(p);
	
	fer(i, 1, n) cnt[p[i]]++;
	leaves_cnt = 0;
	rep(i, n)
		leaves_cnt += (cnt[i] == 0 ? 1 : 0);
}
 
ll query(int l, int r) {
	return leaves_cnt * (ll)l + max(0ll, leaves_cnt * (ll)l - r);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 7240 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 48 ms 6952 KB Output is correct
2 Correct 49 ms 8744 KB Output is correct
3 Correct 62 ms 10044 KB Output is correct
4 Correct 45 ms 9868 KB Output is correct
5 Correct 46 ms 10028 KB Output is correct
6 Correct 46 ms 9684 KB Output is correct
7 Correct 46 ms 10040 KB Output is correct
8 Correct 43 ms 8504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 6952 KB Output is correct
2 Correct 49 ms 8744 KB Output is correct
3 Correct 62 ms 10044 KB Output is correct
4 Correct 45 ms 9868 KB Output is correct
5 Correct 46 ms 10028 KB Output is correct
6 Correct 46 ms 9684 KB Output is correct
7 Correct 46 ms 10040 KB Output is correct
8 Correct 43 ms 8504 KB Output is correct
9 Incorrect 57 ms 10060 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 33 ms 7356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 32 ms 7240 KB Output isn't correct
3 Halted 0 ms 0 KB -