#pragma GCC optimize("Ofast")
#define Magic ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define tsts int tststs; cin >> tststs; while(tststs--)
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
using str = string;
#define sz(a) int(a.size())
#define ppf pop_front
#define ppb pop_back
#define pf push_front
#define pb push_back
#define x1 fukumean1
#define x2 fukumean2
#define y1 fukumean3
#define y2 fukumean4
#define ers erase
#define nxt print() // for new line
#define fix cout << fixed // for decimal numbers
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
void print() {cout << "\n";}
template <typename T>
void print(const T& arg) {
cout << arg << " ";
}
template <typename T, typename... Args>
void print(const T& arg, const Args&... args) {
cout << arg << " ";
print(args...);
}
inline void debugMode() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
const ll N = 2e5 + 100;
map<ll, ll> f[N];
vector<ll> v[N];
vector<deque<ll>> cycles;
ll a[N], h[N], c[N];
ll visited[N];
void merge(ll a, ll b) {
if (sz(f[b]) > sz(f[a]))
f[a].swap(f[b]);
for (auto i : f[b])
f[a][i.first] += i.second;
}
void dfs(ll x) {
// prinqt(x); nxt;
visited[x] = 1;
for (auto to : v[x]) {
dfs(to);
merge(x, to);
}
ll add = c[x];
auto now = f[x].lower_bound(h[x] + 1);
while (now != f[x].begin()) {
now--;
if (add >= now->second) {
add -= now->second;
f[x].ers(now);
} else {
now->second -= add;
add = 0;
break;
}
now = f[x].lower_bound(h[x] + 1);
}
f[x][0] += c[x] - add;
f[x][h[x] + 1] += c[x];
}
signed main() {
Magic
// debugMode();
ll n, res = 0;
cin >> n;
for (ll i = 1; i <= n; i++) {
cin >> a[i] >> h[i] >> c[i];
v[a[i]].pb(i);
}
for (ll i = 1; i <= n; i++) {
deque<ll> t;
ll x = i;
while (!visited[x]) {
// print(x);
t.pb(x);
visited[x] = 1;
x = a[x];
}
// nxt;
while (!t.empty() && t.front() != x)
t.ppf();
if (!t.empty()) {
// if (sz(t) > 1)
// t.ppf();
cycles.pb(t);
}
}
for (ll i = 1; i <= n; i++)
visited[i] = 0;
for (auto cyc : cycles) {
for (auto i : cyc)
visited[i] = 1;
}
for (auto cyc : cycles) {
for (auto i : cyc) {
// print(i);
for (auto to : v[i]) {
if (visited[to])
continue;
dfs(to);
merge(i, to);
}
f[i][0] += c[i];
f[i][h[i]] -= c[i];
f[i][h[i] + 1] += c[i];
if (i != cyc.front())
merge(cyc.front(), i);
}
// nxt;
ll now = 0, mn = 1e18;
for (auto i : f[cyc.front()]) {
now += i.second;
mn = min(mn, now);
}
res += mn;
}
cout << res;
}
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠤⢲⣦⡀⠀⣠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣠⠖⠚⠓⠒⠒⠲⠿⣍⣛⣻⣦⣷⢠⣻⣀⠤⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠔⡿⠓⠲⠬⢥⡤⠤⠤⠤⠤⣤⣀⣀⣈⣻⣿⣿⠓⠉⣀⡤⠔⢶⣻⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⢤⠞⠁⣼⠀⠀⠀⠀⠀⠀⠰⠶⢌⣽⡶⠟⢏⡁⢈⣉⣭⣷⡯⣝⠒⢦⣄⠙⠷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡾⣵⠿⣳⡟⠉⠉⠿⠀⠀⡀⠀⠀⣀⣀⣢⣾⣿⡚⠓⠒⠒⠒⠻⢿⣟⣧⡀⢠⣢⡻⠙⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⢿⣟⣲⢿⣷⢀⣤⣠⣄⣈⢿⣷⣤⣷⣻⡓⠒⠻⠭⢷⡄⠒⠲⢶⣦⣬⣻⣏⢦⡈⢿⣆⠘⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⢖⣩⠷⢎⣙⣿⣿⣼⡼⣿⣟⣽⣻⢯⢿⠞⣌⠙⢳⡕⠀⠙⠲⣶⠤⢄⡠⣄⡈⠛⣿⣿⣧⢳⣌⢻⡆⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⠗⠉⢀⣾⠟⠒⡿⣫⡿⡾⢫⢟⡏⠉⢸⡀⠑⢾⡆⢤⣻⣶⣤⣘⣲⣿⣶⡽⠿⣯⠲⣌⣇⢹⣷⣿⣆⠸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⡼⠀⣿⢣⣧⠋⣸⠀⣰⢀⣿⣆⠀⠰⣄⠙⣧⣨⣿⣿⣿⣯⣿⣦⠘⣷⡌⢻⡄⠿⣆⠟⣆⢇⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⡇⡼⣹⠈⢣⠆⡇⣰⣻⣼⣿⣽⣷⣦⣹⣿⣟⣯⠉⠘⣿⠏⠃⠀⣷⣽⡿⣾⡹⣷⣹⣧⡈⢺⡀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⢾⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⣷⣱⣽⡀⢸⣆⢳⣿⣇⣷⡿⠖⠿⠷⢦⣙⣆⠩⡗⠀⠀⠀⠀⠀⡯⠿⠳⣟⠻⣽⣄⢧⠈⠳⣷⡀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡇⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣿⣿⣷⣸⣿⡀⣿⣅⠛⠇⠀⠀⠀⠀⢈⠙⠂⠀⠀⠀⠀⠀⣸⣿⠀⢠⣜⢦⠘⢿⣮⣷⡀⠀⠙⢦⡀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⢯⣇⠙⢄⣀⠀⠀⠀⢀⣀⡠⣴⣾⣫⠵⠛⣿⣻⠿⣷⣹⣾⣷⡠⡀⠀⠀⠀⠻⠦⠀⣀⠔⠀⠀⣴⣿⣸⣧⡀⠳⣝⠳⢴⡙⢞⣏⠢⡀⠀⠹⡄⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⢀⣀⣀⣈⣻⣤⣀⠈⠉⠻⠿⢿⣺⣿⡵⣶⢶⣦⠀⠘⣿⢷⣾⢿⣿⡋⢙⣮⣄⡀⠀⠀⠉⠈⠀⠀⢀⢞⣿⣼⣿⣿⣿⣆⡀⠙⢦⣝⣮⠛⢷⡙⢆⠀⣷⠀⠀⠀⠀
///⠀⠀⠀⢠⡴⢟⣫⠤⠖⠒⠛⢛⣲⣿⣿⣿⠟⠋⢱⣿⣴⣷⣿⣹⢃⣀⣘⠃⢩⢿⣫⣥⣿⠧⢿⣿⣗⡶⣤⣄⣀⣴⣷⣻⣿⣿⠻⠘⣏⠛⢿⣦⣀⠱⢤⣉⡑⠛⠮⢿⣹⠀⠀⠀⠀
///⠀⢠⢖⠵⠊⠁⢀⡤⠖⣲⣿⣿⣟⣻⣿⣋⠀⠀⠈⢿⣿⡿⠟⣵⣿⣿⣿⣷⡏⠈⢿⡿⣷⣤⣼⢿⣿⣿⢶⣯⣭⣵⣾⢿⣿⠿⢦⡀⢹⠀⠈⣏⠉⠉⢻⣶⣯⡑⠦⣄⠈⠳⣄⠀
///⠀⠹⠁⠀⠀⣞⢁⡾⢽⣯⣝⣛⣛⣯⣭⣽⣿⣷⣶⣤⣤⣴⣿⣿⣿⣿⣿⣿⡀⣀⣼⣀⠈⠙⠛⠷⣾⡿⢿⡟⣿⠟⠁⣈⣥⡴⠾⠷⢾⡄⠀⣿⠀⠀⠈⢇⠘⣿⣤⣀⠑⢦⡘⢧⠀
///⠄⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⡿⠛⣻⢏⡽⣯⡄⠘⣏⣿⡏⠈⠙⠓⠶⣤⣀⠀⠙⢿⣿⡇⢀⡿⠋⠁⠀⢀⣀⣸⡇⠀⣟⣀⠀⠀⠀⠙⠃⣿⡎⠑⣤⡙⣌⡇
///⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⡥⣖⡯⠖⢋⣡⡞⣼⣿⠀⠀⢹⣿⣷⠀⠀⣀⡀⠀⠉⠻⣦⠀⢿⣿⡿⠁⣠⡶⠟⠋⠉⠹⣆⣸⣿⣿⠀⣀⡤⣤⡀⣿⠇⠀⢸⠳⡜⡇
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣈⣿⣿⣿⣿⣿⣿⣏⢿⣗⠒⠊⠉⢸⠁⡿⡏⠀⢀⣿⡿⣁⠤⢶⣿⣽⡆⠀⠀⠘⢷⡈⠉⣡⠾⠋⠀⠀⣠⣆⢠⣿⣿⣿⡟⢀⣷⠒⢺⣧⡏⠀⠀⢸⠀⢹⣹
///⠀⠀⠀⠀⠀⠀⠀⡠⢪⠟⡽⠙⢶⣾⣿⣿⣿⣷⡻⣦⡀⠀⠀⢣⣇⡇⢀⡞⣸⠏⠁⠀⠀⡇⢻⡀⠀⠀⣾⣶⡟⣿⣥⡄⠀⠀⢠⣇⣼⡶⣿⣿⠋⣸⣾⣷⣚⣽⡟⠀⠀⠀⣏⠀⡼⣿
///⠀⠀⠀⠀⠀⢀⠎⡴⣣⣾⠟⣡⠞⢹⡿⣿⢿⣿⣿⣿⣷⣄⠀⠈⠻⡹⣼⠀⣿⡄⠀⠀⠀⠉⠻⣷⡀⠀⠙⠿⠇⣿⠿⠇⠀⠀⢠⡿⠋⢇⢹⣟⢷⠫⣿⣟⡿⠋⠀⠀⣠⣾⢞⡜⠁⡿
///⠀⠀⠀⠀⠀⡼⡼⣵⠏⡏⣰⠃⠀⢾⡇⠈⠻⣿⣮⡉⠹⣿⣧⣄⡀⠙⣇⠀⠸⣿⣄⡀⠀⠀⠀⠈⢉⣧⡴⠀⠠⡄⣀⡤⠤⠴⠋⠁⠀⠈⢻⣿⣾⣤⡿⠋⠀⠀⠀⣉⣽⠿⠋⠀⣰⠃
///⠀⠀⠀⠀⠀⣿⣽⠋⠀⡇⡇⠀⠀⠘⣷⢠⣶⢮⣻⣿⣦⠈⠛⠙⠹⣷⠘⢦⣤⣿⣳⣭⣑⣒⣒⣺⣿⢿⣀⣀⣀⣿⣧⣀⣀⣀⡤⠴⠒⣶⣿⣏⣾⡿⠁⠀⠀⠀⠉⠉⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⢻⡏⠀⠀⢳⣇⠀⠀⠀⠈⠈⣿⣾⣿⣿⣮⣿⣦⠀⠀⢿⣶⡫⣿⣿⣿⣿⣿⡹⣯⣊⠁⠉⠉⠉⠉⢙⣮⣷⣶⡤⣤⣶⣿⣿⣟⣾⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠸⣿⣦⡀⠀⠙⠦⠀⠀⢀⣼⠿⣽⣿⣯⣷⣼⡷⢾⣻⣾⣿⠞⢿⢻⡷⠻⣿⣏⡙⢝⣻⡾⡖⠒⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣎⠣⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠀⠀⠀⣴⣋⣉⣩⣿⣿⢿⣟⣷⣾⣯⡟⢱⡇⠀⠘⣿⠣⡀⣈⣻⣿⣿⣿⣷⣷⣶⣿⣿⣟⠋⡿⣹⣿⣿⣿⣿⢟⣏⠺⠿⠶⠭⠷⠂⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⢹⣮⣾⣿⡿⢋⣶⢸⡇⠀⠀⠈⢷⡑⠈⢻⣟⠛⠛⠿⠋⠙⠓⣭⣿⣹⣵⣿⣿⣿⣿⣿⠈⠻⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⢟⣛⡭⠶⢾⡿⠃⠀⠀⢸⢹⣾⣇⠀⠀⠀⠀⠻⣟⣿⡏⠀⠀⠀⠀⢰⣿⣿⢿⡇⣿⣿⣿⣿⣟⡏⠀⠀⠀⠉⠙⠓⠒⠂⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡟⠀⠀⠀⢰⣿⢸⣿⢿⡀⠀⠀⠀⠀⢸⣿⣣⠀⠀⠀⢠⣿⡟⣷⣾⣿⢿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⠁⠀⠀⠀⠘⡿⡿⢿⣏⣧⠀⠀⠀⢀⣾⣿⠿⠀⢀⣴⣿⣿⢿⡹⡇⣿⠈⣿⣿⡟⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀⠀⠀⢳⢧⠈⢿⣿⠀⠀⢀⣼⣿⠕⠁⣠⣾⡿⣻⠏⠀⢹⣹⣿⣆⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣷⠀⠀⠀⠀⠈⣏⢧⠀⢻⣧⠶⣋⠿⠋⣀⣾⣟⣿⠞⠁⠀⠀⠀⢯⣿⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣇⠀⠀⠀⠀⠸⡜⣆⠈⢷⣿⠀⢠⣾⣿⠟⢻⡏⠀⠀⠀⠀⠀⠘⣿⣿⠏⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡻⣿⣿⣦⡀⠀⠀⠀⢧⠘⣆⠈⢷⠒⠛⢻⡿⠄⠘⣧⠀⠀⠀⠀⠀⢰⣷⣹⠀⠙⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣷⣝⣿⣿⣷⣄⠀⠀⠈⢇⠸⡄⠈⣇⠀⠀⢻⣆⠀⠘⣇⠀⠀⣠⣾⣽⢹⡟⠀⢰⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣾⢻⠙⢿⣿⡇⠀⠀⠈⢧⢳⠀⢸⡀⠀⠀⢻⣆⠀⢻⡄⢠⣿⣯⣽⣓⣧⣤⠾⢹⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣼⡇⠀⠙⣿⠀⠀⠀⠈⢏⢧⠀⣇⠀⠀⠀⢻⣆⠀⢷⠘⣿⣮⡻⣿⠁⠀⢀⣯⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠘⡾⡄⢸⠀⠀⠀⠈⢻⣆⠈⢷⣷⣾⣟⣻⣶⣿⡿⠛⢿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀⢳⣇⠘⡆⠀⠀⠀⠀⠻⣶⢺⡏⢹⡟⠀⠉⠁⠀⠀⠀⢩⣍⠙⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣟⣿⣿⣿⣧⠀⢀⣤⣤⡸⣸⠀⡇⠀⠀⠀⠀⠀⠙⣿⣷⢡⣿⣶⣄⠀⠀⣄⠀⣦⣍⠙⢳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⡿⢿⡙⠿⠀⢸⡟⢲⣷⡿⡄⢿⠀⠀⠀⠀⠀⠀⠘⣏⢸⣇⣍⢻⣷⣀⢻⣦⣤⣌⡙⣦⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣯⢷⠀⠀⠸⡇⠀⢿⣧⡇⢸⠀⠀⠀⠀⠀⠀⠀⣼⢸⣿⣯⠀⣿⣿⣷⣝⣿⣻⣿⣼⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣎⣧⠀⠐⣇⠀⠘⣽⣿⡸⡆⠀⠀⠀⠀⠀⠀⠈⠋⠈⠻⣼⣿⢶⢿⣿⣯⡻⣿⣿⣾⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡼⡆⠀⣿⡀⠀⣿⢿⡇⢷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣾⢧⠈⠙⠿⣮⠟⠉⠙⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⢻⢠⣿⡇⠀⠹⣄⢳⣜⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡏⠪⠳⢤⣄⣀⠀⠀⠀⠈⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀
///⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣎⣿⡟⡇⠀⠀⠈⢻⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢳⡄⠀⠀⠀⠙⢧⡀⢀⡄⠈⡇⠀⠀⠀⠀⠀⠀⠀⠀
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
20568 KB |
Output is correct |
2 |
Correct |
5 ms |
20824 KB |
Output is correct |
3 |
Correct |
6 ms |
20640 KB |
Output is correct |
4 |
Correct |
6 ms |
20420 KB |
Output is correct |
5 |
Correct |
10 ms |
21852 KB |
Output is correct |
6 |
Correct |
8 ms |
21352 KB |
Output is correct |
7 |
Correct |
8 ms |
21384 KB |
Output is correct |
8 |
Correct |
11 ms |
21852 KB |
Output is correct |
9 |
Correct |
8 ms |
21340 KB |
Output is correct |
10 |
Correct |
8 ms |
21340 KB |
Output is correct |
11 |
Correct |
7 ms |
21188 KB |
Output is correct |
12 |
Correct |
10 ms |
21340 KB |
Output is correct |
13 |
Correct |
7 ms |
21340 KB |
Output is correct |
14 |
Correct |
7 ms |
21080 KB |
Output is correct |
15 |
Correct |
7 ms |
21084 KB |
Output is correct |
16 |
Correct |
10 ms |
22364 KB |
Output is correct |
17 |
Correct |
9 ms |
21596 KB |
Output is correct |
18 |
Correct |
7 ms |
21084 KB |
Output is correct |
19 |
Correct |
9 ms |
21336 KB |
Output is correct |
20 |
Correct |
7 ms |
21340 KB |
Output is correct |
21 |
Correct |
7 ms |
21340 KB |
Output is correct |
22 |
Correct |
9 ms |
21692 KB |
Output is correct |
23 |
Correct |
9 ms |
21592 KB |
Output is correct |
24 |
Correct |
8 ms |
21596 KB |
Output is correct |
25 |
Correct |
7 ms |
21340 KB |
Output is correct |
26 |
Correct |
7 ms |
21340 KB |
Output is correct |
27 |
Correct |
8 ms |
21596 KB |
Output is correct |
28 |
Correct |
8 ms |
21596 KB |
Output is correct |
29 |
Correct |
8 ms |
21596 KB |
Output is correct |
30 |
Correct |
8 ms |
21596 KB |
Output is correct |
31 |
Correct |
9 ms |
21596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
20568 KB |
Output is correct |
2 |
Correct |
5 ms |
20824 KB |
Output is correct |
3 |
Correct |
6 ms |
20640 KB |
Output is correct |
4 |
Correct |
6 ms |
20420 KB |
Output is correct |
5 |
Correct |
10 ms |
21852 KB |
Output is correct |
6 |
Correct |
8 ms |
21352 KB |
Output is correct |
7 |
Correct |
8 ms |
21384 KB |
Output is correct |
8 |
Correct |
11 ms |
21852 KB |
Output is correct |
9 |
Correct |
8 ms |
21340 KB |
Output is correct |
10 |
Correct |
8 ms |
21340 KB |
Output is correct |
11 |
Correct |
7 ms |
21188 KB |
Output is correct |
12 |
Correct |
10 ms |
21340 KB |
Output is correct |
13 |
Correct |
7 ms |
21340 KB |
Output is correct |
14 |
Correct |
7 ms |
21080 KB |
Output is correct |
15 |
Correct |
7 ms |
21084 KB |
Output is correct |
16 |
Correct |
10 ms |
22364 KB |
Output is correct |
17 |
Correct |
9 ms |
21596 KB |
Output is correct |
18 |
Correct |
7 ms |
21084 KB |
Output is correct |
19 |
Correct |
9 ms |
21336 KB |
Output is correct |
20 |
Correct |
7 ms |
21340 KB |
Output is correct |
21 |
Correct |
7 ms |
21340 KB |
Output is correct |
22 |
Correct |
9 ms |
21692 KB |
Output is correct |
23 |
Correct |
9 ms |
21592 KB |
Output is correct |
24 |
Correct |
8 ms |
21596 KB |
Output is correct |
25 |
Correct |
7 ms |
21340 KB |
Output is correct |
26 |
Correct |
7 ms |
21340 KB |
Output is correct |
27 |
Correct |
8 ms |
21596 KB |
Output is correct |
28 |
Correct |
8 ms |
21596 KB |
Output is correct |
29 |
Correct |
8 ms |
21596 KB |
Output is correct |
30 |
Correct |
8 ms |
21596 KB |
Output is correct |
31 |
Correct |
9 ms |
21596 KB |
Output is correct |
32 |
Correct |
10 ms |
21932 KB |
Output is correct |
33 |
Correct |
290 ms |
90192 KB |
Output is correct |
34 |
Correct |
221 ms |
65188 KB |
Output is correct |
35 |
Correct |
289 ms |
87176 KB |
Output is correct |
36 |
Correct |
269 ms |
65364 KB |
Output is correct |
37 |
Correct |
152 ms |
46396 KB |
Output is correct |
38 |
Correct |
162 ms |
41908 KB |
Output is correct |
39 |
Correct |
126 ms |
47872 KB |
Output is correct |
40 |
Correct |
111 ms |
47784 KB |
Output is correct |
41 |
Correct |
80 ms |
47768 KB |
Output is correct |
42 |
Correct |
118 ms |
40016 KB |
Output is correct |
43 |
Correct |
129 ms |
40012 KB |
Output is correct |
44 |
Correct |
311 ms |
114516 KB |
Output is correct |
45 |
Correct |
200 ms |
78928 KB |
Output is correct |
46 |
Correct |
85 ms |
41276 KB |
Output is correct |
47 |
Correct |
193 ms |
56292 KB |
Output is correct |
48 |
Correct |
106 ms |
49232 KB |
Output is correct |
49 |
Correct |
89 ms |
49596 KB |
Output is correct |
50 |
Correct |
232 ms |
64192 KB |
Output is correct |
51 |
Correct |
88 ms |
51656 KB |
Output is correct |
52 |
Correct |
211 ms |
57360 KB |
Output is correct |
53 |
Correct |
100 ms |
50176 KB |
Output is correct |
54 |
Correct |
87 ms |
47956 KB |
Output is correct |
55 |
Correct |
172 ms |
58596 KB |
Output is correct |
56 |
Correct |
141 ms |
57680 KB |
Output is correct |
57 |
Correct |
134 ms |
58036 KB |
Output is correct |
58 |
Correct |
138 ms |
57940 KB |
Output is correct |
59 |
Correct |
138 ms |
57912 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
20568 KB |
Output is correct |
2 |
Correct |
5 ms |
20824 KB |
Output is correct |
3 |
Correct |
6 ms |
20640 KB |
Output is correct |
4 |
Correct |
6 ms |
20420 KB |
Output is correct |
5 |
Correct |
10 ms |
21852 KB |
Output is correct |
6 |
Correct |
8 ms |
21352 KB |
Output is correct |
7 |
Correct |
8 ms |
21384 KB |
Output is correct |
8 |
Correct |
11 ms |
21852 KB |
Output is correct |
9 |
Correct |
8 ms |
21340 KB |
Output is correct |
10 |
Correct |
8 ms |
21340 KB |
Output is correct |
11 |
Correct |
7 ms |
21188 KB |
Output is correct |
12 |
Correct |
10 ms |
21340 KB |
Output is correct |
13 |
Correct |
7 ms |
21340 KB |
Output is correct |
14 |
Correct |
7 ms |
21080 KB |
Output is correct |
15 |
Correct |
7 ms |
21084 KB |
Output is correct |
16 |
Correct |
10 ms |
22364 KB |
Output is correct |
17 |
Correct |
9 ms |
21596 KB |
Output is correct |
18 |
Correct |
7 ms |
21084 KB |
Output is correct |
19 |
Correct |
9 ms |
21336 KB |
Output is correct |
20 |
Correct |
7 ms |
21340 KB |
Output is correct |
21 |
Correct |
7 ms |
21340 KB |
Output is correct |
22 |
Correct |
9 ms |
21692 KB |
Output is correct |
23 |
Correct |
9 ms |
21592 KB |
Output is correct |
24 |
Correct |
8 ms |
21596 KB |
Output is correct |
25 |
Correct |
7 ms |
21340 KB |
Output is correct |
26 |
Correct |
7 ms |
21340 KB |
Output is correct |
27 |
Correct |
8 ms |
21596 KB |
Output is correct |
28 |
Correct |
8 ms |
21596 KB |
Output is correct |
29 |
Correct |
8 ms |
21596 KB |
Output is correct |
30 |
Correct |
8 ms |
21596 KB |
Output is correct |
31 |
Correct |
9 ms |
21596 KB |
Output is correct |
32 |
Correct |
10 ms |
21932 KB |
Output is correct |
33 |
Correct |
290 ms |
90192 KB |
Output is correct |
34 |
Correct |
221 ms |
65188 KB |
Output is correct |
35 |
Correct |
289 ms |
87176 KB |
Output is correct |
36 |
Correct |
269 ms |
65364 KB |
Output is correct |
37 |
Correct |
152 ms |
46396 KB |
Output is correct |
38 |
Correct |
162 ms |
41908 KB |
Output is correct |
39 |
Correct |
126 ms |
47872 KB |
Output is correct |
40 |
Correct |
111 ms |
47784 KB |
Output is correct |
41 |
Correct |
80 ms |
47768 KB |
Output is correct |
42 |
Correct |
118 ms |
40016 KB |
Output is correct |
43 |
Correct |
129 ms |
40012 KB |
Output is correct |
44 |
Correct |
311 ms |
114516 KB |
Output is correct |
45 |
Correct |
200 ms |
78928 KB |
Output is correct |
46 |
Correct |
85 ms |
41276 KB |
Output is correct |
47 |
Correct |
193 ms |
56292 KB |
Output is correct |
48 |
Correct |
106 ms |
49232 KB |
Output is correct |
49 |
Correct |
89 ms |
49596 KB |
Output is correct |
50 |
Correct |
232 ms |
64192 KB |
Output is correct |
51 |
Correct |
88 ms |
51656 KB |
Output is correct |
52 |
Correct |
211 ms |
57360 KB |
Output is correct |
53 |
Correct |
100 ms |
50176 KB |
Output is correct |
54 |
Correct |
87 ms |
47956 KB |
Output is correct |
55 |
Correct |
172 ms |
58596 KB |
Output is correct |
56 |
Correct |
141 ms |
57680 KB |
Output is correct |
57 |
Correct |
134 ms |
58036 KB |
Output is correct |
58 |
Correct |
138 ms |
57940 KB |
Output is correct |
59 |
Correct |
138 ms |
57912 KB |
Output is correct |
60 |
Correct |
5 ms |
20572 KB |
Output is correct |
61 |
Correct |
5 ms |
20572 KB |
Output is correct |
62 |
Correct |
5 ms |
20572 KB |
Output is correct |
63 |
Correct |
5 ms |
20572 KB |
Output is correct |
64 |
Correct |
273 ms |
73272 KB |
Output is correct |
65 |
Correct |
226 ms |
56516 KB |
Output is correct |
66 |
Correct |
319 ms |
73852 KB |
Output is correct |
67 |
Correct |
212 ms |
56500 KB |
Output is correct |
68 |
Correct |
170 ms |
42772 KB |
Output is correct |
69 |
Correct |
146 ms |
39504 KB |
Output is correct |
70 |
Correct |
430 ms |
96464 KB |
Output is correct |
71 |
Correct |
231 ms |
71696 KB |
Output is correct |
72 |
Correct |
478 ms |
98092 KB |
Output is correct |
73 |
Correct |
235 ms |
73040 KB |
Output is correct |
74 |
Correct |
425 ms |
74524 KB |
Output is correct |
75 |
Correct |
190 ms |
55636 KB |
Output is correct |
76 |
Correct |
179 ms |
54268 KB |
Output is correct |
77 |
Correct |
418 ms |
85456 KB |
Output is correct |
78 |
Correct |
191 ms |
62816 KB |
Output is correct |
79 |
Correct |
396 ms |
97596 KB |
Output is correct |
80 |
Correct |
233 ms |
70576 KB |
Output is correct |
81 |
Correct |
231 ms |
59912 KB |
Output is correct |
82 |
Correct |
349 ms |
98144 KB |
Output is correct |
83 |
Correct |
252 ms |
206016 KB |
Output is correct |
84 |
Correct |
331 ms |
85556 KB |
Output is correct |
85 |
Correct |
364 ms |
85756 KB |
Output is correct |
86 |
Correct |
298 ms |
73300 KB |
Output is correct |
87 |
Correct |
307 ms |
79344 KB |
Output is correct |
88 |
Correct |
319 ms |
79660 KB |
Output is correct |