#ifndef TEST
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#endif
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define roF(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define mp make_pair
#define sz(a) (int) (a).size()
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
using namespace std;
using vi = vector<int>;
using ll = long long;
using pi = pair<int, int>;
// #define int ll;
mt19937 rng(random_device {}());
int rand(int a){
return rng() % a;
}
const int N = 100005;
const int inf = 0x3f3f3f3f;
namespace fastIO {
template <class T>
inline void read(T &x){
x = 0;
bool fu = 0; char ch = 0;
while(ch > '9' or ch < '0'){
ch = getchar(); if(ch == '-') fu = 1;
}
while(ch <= '9' and ch >= '0'){
x = (x * 10 - 48 + ch), ch = getchar();
}
if(fu) x = -x;
}
inline int read(){
int x = 0;
bool fu = 0; char ch = 0;
while(ch >'9' or ch < '0'){
ch = getchar(); if(ch == '-') fu = 1;
}
while(ch <= '9' and ch >= '0'){
x = (x * 10 - 48 + ch), ch = getchar();
}
return fu ? -x : x;
}
template <class T, class... Args>
inline void read(T& t, Args&... args){
read(t); read(args...);
}
char _n_u_m_[40];
template <class T>
inline void write(T x){
if(!x){ putchar('0'); return; }
T tmp = x > 0 ? x : -x;
if( x < 0 ) putchar('-');
register int cnt = 0;
while(tmp) {
_n_u_m_[ cnt ++ ] = tmp % 10 + '0'; tmp /= 10;
}
while(cnt) putchar(_n_u_m_[ -- cnt ]) ;
}
template <class T>
inline void write(T x , char ch) {
write(x); putchar(ch);
}
}
using namespace fastIO;
#ifdef LOCAL
#define debug(x) cout << #x << " = " << x << "\n";
#else
#define debug(x) ;
#endif
template <class T>
istream& operator >> (istream& in, vector<T> &x){
for (auto &i : x) in >> i;
return in;
}
template <class T>
ostream& operator << (ostream& out, vector<T> x){
out << "[";
For(i, 0, sz(x) - 1){
out << (i ? ", " : "") << x[i];
}
out << "]";
return out;
}
template <class A, class B>
ostream& operator << (ostream& out, pair<A, B> x){
out << "(" << x.fi << ", " << x.se << ")";
return out;
}
struct edge{
ll x, c;
edge(){}
edge(ll x, ll c) : x(x), c(c){}
bool operator < (const edge &e) const{
return c > e.c;
}
};
int n, a[N];
ll sum, c[N];
vector<edge> e[N];
bool vis[N], siv[N], cyc[N];
vi comp;
void fdfs(int x){
if(x < 1 or vis[x]) return;
comp.pb(x); vis[x] = 1;
for(auto &i : e[x]) fdfs(i.x);
fdfs(a[x]);
}
void rmain(){
cin >> n;
For(i, 1, n){
cin >> a[i] >> c[i];
sum += c[i];
e[a[i]].pb(edge(i, c[i]));
e[i].pb(edge(-1, 0));
}
For(i, 1, n) sort(all(e[i]));
For(i, 1, n){
if(vis[i]) continue;
comp.clear(); fdfs(i);
vi cycle;
int z = i;
while(!siv[z]){
siv[z] = 1;
cycle.pb(z);
z = a[z];
}
cycle.erase(cycle.begin(), find(all(cycle), z));
for(auto &c : cycle) cyc[c] = 1;
if(sz(cycle) == n){
cout << "0"; return;
}
ll res = 0, ser = 0;
for(auto &cc : comp) res += e[cc][0].c;
for(auto &x : cycle){
ser = max(ser, res - e[x][0].c + (cyc[e[x][0].x] ? e[x][1].c : e[x][0].c));
}
sum -= ser;
}
cout << sum;
}
signed main(){
#ifdef LOCAL
using namespace chrono;
auto start = high_resolution_clock::now();
#endif
// freopen("cf.inp", "r", stdin);
// freopen("cf.out", "w", stdout);
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int T = 1;
while(T--) rmain();
#ifdef LOCAL
auto end = high_resolution_clock::now();
auto dur = duration_cast <milliseconds> (end - start).count();
cout << "\n[" << dur << "ms]\n";
#endif
return 0;
}
Compilation message
telegraph.cpp: In function 'void fastIO::write(T)':
telegraph.cpp:61:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
61 | register int cnt = 0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2688 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2692 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2648 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Correct |
2 ms |
2644 KB |
Output is correct |
10 |
Correct |
2 ms |
2644 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2692 KB |
Output is correct |
13 |
Correct |
2 ms |
2696 KB |
Output is correct |
14 |
Correct |
2 ms |
2696 KB |
Output is correct |
15 |
Correct |
2 ms |
2692 KB |
Output is correct |
16 |
Correct |
2 ms |
2644 KB |
Output is correct |
17 |
Correct |
2 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
2 ms |
2644 KB |
Output is correct |
22 |
Correct |
2 ms |
2688 KB |
Output is correct |
23 |
Correct |
2 ms |
2692 KB |
Output is correct |
24 |
Correct |
2 ms |
2696 KB |
Output is correct |
25 |
Correct |
2 ms |
2688 KB |
Output is correct |
26 |
Correct |
2 ms |
2684 KB |
Output is correct |
27 |
Correct |
2 ms |
2660 KB |
Output is correct |
28 |
Correct |
2 ms |
2644 KB |
Output is correct |
29 |
Correct |
2 ms |
2696 KB |
Output is correct |
30 |
Correct |
2 ms |
2644 KB |
Output is correct |
31 |
Correct |
2 ms |
2644 KB |
Output is correct |
32 |
Correct |
2 ms |
2696 KB |
Output is correct |
33 |
Correct |
2 ms |
2644 KB |
Output is correct |
34 |
Correct |
2 ms |
2644 KB |
Output is correct |
35 |
Correct |
2 ms |
2696 KB |
Output is correct |
36 |
Correct |
2 ms |
2692 KB |
Output is correct |
37 |
Correct |
2 ms |
2772 KB |
Output is correct |
38 |
Correct |
2 ms |
2644 KB |
Output is correct |
39 |
Correct |
2 ms |
2644 KB |
Output is correct |
40 |
Correct |
2 ms |
2644 KB |
Output is correct |
41 |
Correct |
2 ms |
2644 KB |
Output is correct |
42 |
Correct |
2 ms |
2692 KB |
Output is correct |
43 |
Correct |
2 ms |
2696 KB |
Output is correct |
44 |
Correct |
2 ms |
2692 KB |
Output is correct |
45 |
Correct |
2 ms |
2644 KB |
Output is correct |
46 |
Correct |
2 ms |
2688 KB |
Output is correct |
47 |
Correct |
2 ms |
2692 KB |
Output is correct |
48 |
Correct |
2 ms |
2696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2688 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2692 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2648 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Correct |
2 ms |
2644 KB |
Output is correct |
10 |
Correct |
2 ms |
2644 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2692 KB |
Output is correct |
13 |
Correct |
2 ms |
2696 KB |
Output is correct |
14 |
Correct |
2 ms |
2696 KB |
Output is correct |
15 |
Correct |
2 ms |
2692 KB |
Output is correct |
16 |
Correct |
2 ms |
2644 KB |
Output is correct |
17 |
Correct |
2 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
2 ms |
2644 KB |
Output is correct |
22 |
Correct |
2 ms |
2688 KB |
Output is correct |
23 |
Correct |
2 ms |
2692 KB |
Output is correct |
24 |
Correct |
2 ms |
2696 KB |
Output is correct |
25 |
Correct |
2 ms |
2688 KB |
Output is correct |
26 |
Correct |
2 ms |
2684 KB |
Output is correct |
27 |
Correct |
2 ms |
2660 KB |
Output is correct |
28 |
Correct |
2 ms |
2644 KB |
Output is correct |
29 |
Correct |
2 ms |
2696 KB |
Output is correct |
30 |
Correct |
2 ms |
2644 KB |
Output is correct |
31 |
Correct |
2 ms |
2644 KB |
Output is correct |
32 |
Correct |
2 ms |
2696 KB |
Output is correct |
33 |
Correct |
2 ms |
2644 KB |
Output is correct |
34 |
Correct |
2 ms |
2644 KB |
Output is correct |
35 |
Correct |
2 ms |
2696 KB |
Output is correct |
36 |
Correct |
2 ms |
2692 KB |
Output is correct |
37 |
Correct |
2 ms |
2772 KB |
Output is correct |
38 |
Correct |
2 ms |
2644 KB |
Output is correct |
39 |
Correct |
2 ms |
2644 KB |
Output is correct |
40 |
Correct |
2 ms |
2644 KB |
Output is correct |
41 |
Correct |
2 ms |
2644 KB |
Output is correct |
42 |
Correct |
2 ms |
2692 KB |
Output is correct |
43 |
Correct |
2 ms |
2696 KB |
Output is correct |
44 |
Correct |
2 ms |
2692 KB |
Output is correct |
45 |
Correct |
2 ms |
2644 KB |
Output is correct |
46 |
Correct |
2 ms |
2688 KB |
Output is correct |
47 |
Correct |
2 ms |
2692 KB |
Output is correct |
48 |
Correct |
2 ms |
2696 KB |
Output is correct |
49 |
Correct |
2 ms |
2644 KB |
Output is correct |
50 |
Correct |
2 ms |
2644 KB |
Output is correct |
51 |
Correct |
2 ms |
2644 KB |
Output is correct |
52 |
Correct |
2 ms |
2644 KB |
Output is correct |
53 |
Correct |
2 ms |
2644 KB |
Output is correct |
54 |
Correct |
2 ms |
2692 KB |
Output is correct |
55 |
Correct |
2 ms |
2644 KB |
Output is correct |
56 |
Correct |
2 ms |
2644 KB |
Output is correct |
57 |
Correct |
2 ms |
2644 KB |
Output is correct |
58 |
Correct |
2 ms |
2644 KB |
Output is correct |
59 |
Correct |
2 ms |
2692 KB |
Output is correct |
60 |
Correct |
2 ms |
2644 KB |
Output is correct |
61 |
Correct |
2 ms |
2692 KB |
Output is correct |
62 |
Correct |
2 ms |
2644 KB |
Output is correct |
63 |
Correct |
2 ms |
2696 KB |
Output is correct |
64 |
Correct |
2 ms |
2644 KB |
Output is correct |
65 |
Correct |
2 ms |
2644 KB |
Output is correct |
66 |
Correct |
2 ms |
2644 KB |
Output is correct |
67 |
Correct |
2 ms |
2644 KB |
Output is correct |
68 |
Correct |
2 ms |
2644 KB |
Output is correct |
69 |
Correct |
2 ms |
2644 KB |
Output is correct |
70 |
Correct |
2 ms |
2644 KB |
Output is correct |
71 |
Correct |
1 ms |
2644 KB |
Output is correct |
72 |
Correct |
2 ms |
2688 KB |
Output is correct |
73 |
Correct |
2 ms |
2644 KB |
Output is correct |
74 |
Correct |
2 ms |
2772 KB |
Output is correct |
75 |
Correct |
3 ms |
2644 KB |
Output is correct |
76 |
Correct |
2 ms |
2644 KB |
Output is correct |
77 |
Correct |
2 ms |
2644 KB |
Output is correct |
78 |
Correct |
2 ms |
2692 KB |
Output is correct |
79 |
Correct |
2 ms |
2644 KB |
Output is correct |
80 |
Correct |
2 ms |
2644 KB |
Output is correct |
81 |
Correct |
2 ms |
2692 KB |
Output is correct |
82 |
Correct |
2 ms |
2644 KB |
Output is correct |
83 |
Correct |
2 ms |
2644 KB |
Output is correct |
84 |
Correct |
2 ms |
2644 KB |
Output is correct |
85 |
Correct |
2 ms |
2652 KB |
Output is correct |
86 |
Correct |
2 ms |
2684 KB |
Output is correct |
87 |
Correct |
2 ms |
2644 KB |
Output is correct |
88 |
Correct |
2 ms |
2644 KB |
Output is correct |
89 |
Correct |
2 ms |
2644 KB |
Output is correct |
90 |
Correct |
2 ms |
2644 KB |
Output is correct |
91 |
Correct |
2 ms |
2644 KB |
Output is correct |
92 |
Correct |
1 ms |
2644 KB |
Output is correct |
93 |
Correct |
2 ms |
2644 KB |
Output is correct |
94 |
Correct |
2 ms |
2652 KB |
Output is correct |
95 |
Correct |
2 ms |
2644 KB |
Output is correct |
96 |
Correct |
2 ms |
2696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2688 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2692 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2648 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Correct |
2 ms |
2644 KB |
Output is correct |
10 |
Correct |
2 ms |
2644 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2692 KB |
Output is correct |
13 |
Correct |
2 ms |
2696 KB |
Output is correct |
14 |
Correct |
2 ms |
2696 KB |
Output is correct |
15 |
Correct |
2 ms |
2692 KB |
Output is correct |
16 |
Correct |
2 ms |
2644 KB |
Output is correct |
17 |
Correct |
2 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
2 ms |
2644 KB |
Output is correct |
22 |
Correct |
2 ms |
2688 KB |
Output is correct |
23 |
Correct |
2 ms |
2692 KB |
Output is correct |
24 |
Correct |
2 ms |
2696 KB |
Output is correct |
25 |
Correct |
2 ms |
2688 KB |
Output is correct |
26 |
Correct |
2 ms |
2684 KB |
Output is correct |
27 |
Correct |
2 ms |
2660 KB |
Output is correct |
28 |
Correct |
2 ms |
2644 KB |
Output is correct |
29 |
Correct |
2 ms |
2696 KB |
Output is correct |
30 |
Correct |
2 ms |
2644 KB |
Output is correct |
31 |
Correct |
2 ms |
2644 KB |
Output is correct |
32 |
Correct |
2 ms |
2696 KB |
Output is correct |
33 |
Correct |
2 ms |
2644 KB |
Output is correct |
34 |
Correct |
2 ms |
2644 KB |
Output is correct |
35 |
Correct |
2 ms |
2696 KB |
Output is correct |
36 |
Correct |
2 ms |
2692 KB |
Output is correct |
37 |
Correct |
2 ms |
2772 KB |
Output is correct |
38 |
Correct |
2 ms |
2644 KB |
Output is correct |
39 |
Correct |
2 ms |
2644 KB |
Output is correct |
40 |
Correct |
2 ms |
2644 KB |
Output is correct |
41 |
Correct |
2 ms |
2644 KB |
Output is correct |
42 |
Correct |
2 ms |
2692 KB |
Output is correct |
43 |
Correct |
2 ms |
2696 KB |
Output is correct |
44 |
Correct |
2 ms |
2692 KB |
Output is correct |
45 |
Correct |
2 ms |
2644 KB |
Output is correct |
46 |
Correct |
2 ms |
2688 KB |
Output is correct |
47 |
Correct |
2 ms |
2692 KB |
Output is correct |
48 |
Correct |
2 ms |
2696 KB |
Output is correct |
49 |
Correct |
2 ms |
2644 KB |
Output is correct |
50 |
Correct |
2 ms |
2644 KB |
Output is correct |
51 |
Correct |
2 ms |
2644 KB |
Output is correct |
52 |
Correct |
2 ms |
2644 KB |
Output is correct |
53 |
Correct |
2 ms |
2644 KB |
Output is correct |
54 |
Correct |
2 ms |
2692 KB |
Output is correct |
55 |
Correct |
2 ms |
2644 KB |
Output is correct |
56 |
Correct |
2 ms |
2644 KB |
Output is correct |
57 |
Correct |
2 ms |
2644 KB |
Output is correct |
58 |
Correct |
2 ms |
2644 KB |
Output is correct |
59 |
Correct |
2 ms |
2692 KB |
Output is correct |
60 |
Correct |
2 ms |
2644 KB |
Output is correct |
61 |
Correct |
2 ms |
2692 KB |
Output is correct |
62 |
Correct |
2 ms |
2644 KB |
Output is correct |
63 |
Correct |
2 ms |
2696 KB |
Output is correct |
64 |
Correct |
2 ms |
2644 KB |
Output is correct |
65 |
Correct |
2 ms |
2644 KB |
Output is correct |
66 |
Correct |
2 ms |
2644 KB |
Output is correct |
67 |
Correct |
2 ms |
2644 KB |
Output is correct |
68 |
Correct |
2 ms |
2644 KB |
Output is correct |
69 |
Correct |
2 ms |
2644 KB |
Output is correct |
70 |
Correct |
2 ms |
2644 KB |
Output is correct |
71 |
Correct |
1 ms |
2644 KB |
Output is correct |
72 |
Correct |
2 ms |
2688 KB |
Output is correct |
73 |
Correct |
2 ms |
2644 KB |
Output is correct |
74 |
Correct |
2 ms |
2772 KB |
Output is correct |
75 |
Correct |
3 ms |
2644 KB |
Output is correct |
76 |
Correct |
2 ms |
2644 KB |
Output is correct |
77 |
Correct |
2 ms |
2644 KB |
Output is correct |
78 |
Correct |
2 ms |
2692 KB |
Output is correct |
79 |
Correct |
2 ms |
2644 KB |
Output is correct |
80 |
Correct |
2 ms |
2644 KB |
Output is correct |
81 |
Correct |
2 ms |
2692 KB |
Output is correct |
82 |
Correct |
2 ms |
2644 KB |
Output is correct |
83 |
Correct |
2 ms |
2644 KB |
Output is correct |
84 |
Correct |
2 ms |
2644 KB |
Output is correct |
85 |
Correct |
2 ms |
2652 KB |
Output is correct |
86 |
Correct |
2 ms |
2684 KB |
Output is correct |
87 |
Correct |
2 ms |
2644 KB |
Output is correct |
88 |
Correct |
2 ms |
2644 KB |
Output is correct |
89 |
Correct |
2 ms |
2644 KB |
Output is correct |
90 |
Correct |
2 ms |
2644 KB |
Output is correct |
91 |
Correct |
2 ms |
2644 KB |
Output is correct |
92 |
Correct |
1 ms |
2644 KB |
Output is correct |
93 |
Correct |
2 ms |
2644 KB |
Output is correct |
94 |
Correct |
2 ms |
2652 KB |
Output is correct |
95 |
Correct |
2 ms |
2644 KB |
Output is correct |
96 |
Correct |
2 ms |
2696 KB |
Output is correct |
97 |
Correct |
3 ms |
2900 KB |
Output is correct |
98 |
Correct |
3 ms |
2964 KB |
Output is correct |
99 |
Correct |
3 ms |
2964 KB |
Output is correct |
100 |
Correct |
3 ms |
2880 KB |
Output is correct |
101 |
Correct |
3 ms |
2900 KB |
Output is correct |
102 |
Correct |
3 ms |
3028 KB |
Output is correct |
103 |
Correct |
3 ms |
3088 KB |
Output is correct |
104 |
Correct |
3 ms |
3084 KB |
Output is correct |
105 |
Correct |
3 ms |
3028 KB |
Output is correct |
106 |
Correct |
3 ms |
3032 KB |
Output is correct |
107 |
Correct |
3 ms |
3028 KB |
Output is correct |
108 |
Correct |
4 ms |
3028 KB |
Output is correct |
109 |
Correct |
3 ms |
3028 KB |
Output is correct |
110 |
Correct |
4 ms |
2968 KB |
Output is correct |
111 |
Correct |
3 ms |
3028 KB |
Output is correct |
112 |
Correct |
3 ms |
3028 KB |
Output is correct |
113 |
Correct |
3 ms |
3028 KB |
Output is correct |
114 |
Correct |
3 ms |
3028 KB |
Output is correct |
115 |
Correct |
2 ms |
3028 KB |
Output is correct |
116 |
Correct |
3 ms |
2900 KB |
Output is correct |
117 |
Correct |
3 ms |
3028 KB |
Output is correct |
118 |
Correct |
3 ms |
3028 KB |
Output is correct |
119 |
Correct |
3 ms |
3028 KB |
Output is correct |
120 |
Correct |
2 ms |
2900 KB |
Output is correct |
121 |
Correct |
3 ms |
2868 KB |
Output is correct |
122 |
Correct |
3 ms |
2900 KB |
Output is correct |
123 |
Correct |
3 ms |
2900 KB |
Output is correct |
124 |
Correct |
3 ms |
2900 KB |
Output is correct |
125 |
Correct |
3 ms |
2900 KB |
Output is correct |
126 |
Correct |
3 ms |
2900 KB |
Output is correct |
127 |
Correct |
3 ms |
2832 KB |
Output is correct |
128 |
Correct |
3 ms |
2956 KB |
Output is correct |
129 |
Correct |
3 ms |
3028 KB |
Output is correct |
130 |
Correct |
3 ms |
3028 KB |
Output is correct |
131 |
Correct |
3 ms |
3028 KB |
Output is correct |
132 |
Correct |
4 ms |
3028 KB |
Output is correct |
133 |
Correct |
3 ms |
2900 KB |
Output is correct |
134 |
Correct |
3 ms |
2960 KB |
Output is correct |
135 |
Correct |
3 ms |
2900 KB |
Output is correct |
136 |
Correct |
4 ms |
2900 KB |
Output is correct |
137 |
Correct |
2 ms |
2772 KB |
Output is correct |
138 |
Correct |
2 ms |
2772 KB |
Output is correct |
139 |
Correct |
2 ms |
2772 KB |
Output is correct |
140 |
Correct |
2 ms |
2772 KB |
Output is correct |
141 |
Correct |
3 ms |
2804 KB |
Output is correct |
142 |
Correct |
2 ms |
2772 KB |
Output is correct |
143 |
Correct |
2 ms |
2868 KB |
Output is correct |
144 |
Correct |
2 ms |
2772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2688 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
2 ms |
2692 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2648 KB |
Output is correct |
8 |
Correct |
2 ms |
2644 KB |
Output is correct |
9 |
Correct |
2 ms |
2644 KB |
Output is correct |
10 |
Correct |
2 ms |
2644 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2692 KB |
Output is correct |
13 |
Correct |
2 ms |
2696 KB |
Output is correct |
14 |
Correct |
2 ms |
2696 KB |
Output is correct |
15 |
Correct |
2 ms |
2692 KB |
Output is correct |
16 |
Correct |
2 ms |
2644 KB |
Output is correct |
17 |
Correct |
2 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
2 ms |
2644 KB |
Output is correct |
22 |
Correct |
2 ms |
2688 KB |
Output is correct |
23 |
Correct |
2 ms |
2692 KB |
Output is correct |
24 |
Correct |
2 ms |
2696 KB |
Output is correct |
25 |
Correct |
2 ms |
2688 KB |
Output is correct |
26 |
Correct |
2 ms |
2684 KB |
Output is correct |
27 |
Correct |
2 ms |
2660 KB |
Output is correct |
28 |
Correct |
2 ms |
2644 KB |
Output is correct |
29 |
Correct |
2 ms |
2696 KB |
Output is correct |
30 |
Correct |
2 ms |
2644 KB |
Output is correct |
31 |
Correct |
2 ms |
2644 KB |
Output is correct |
32 |
Correct |
2 ms |
2696 KB |
Output is correct |
33 |
Correct |
2 ms |
2644 KB |
Output is correct |
34 |
Correct |
2 ms |
2644 KB |
Output is correct |
35 |
Correct |
2 ms |
2696 KB |
Output is correct |
36 |
Correct |
2 ms |
2692 KB |
Output is correct |
37 |
Correct |
2 ms |
2772 KB |
Output is correct |
38 |
Correct |
2 ms |
2644 KB |
Output is correct |
39 |
Correct |
2 ms |
2644 KB |
Output is correct |
40 |
Correct |
2 ms |
2644 KB |
Output is correct |
41 |
Correct |
2 ms |
2644 KB |
Output is correct |
42 |
Correct |
2 ms |
2692 KB |
Output is correct |
43 |
Correct |
2 ms |
2696 KB |
Output is correct |
44 |
Correct |
2 ms |
2692 KB |
Output is correct |
45 |
Correct |
2 ms |
2644 KB |
Output is correct |
46 |
Correct |
2 ms |
2688 KB |
Output is correct |
47 |
Correct |
2 ms |
2692 KB |
Output is correct |
48 |
Correct |
2 ms |
2696 KB |
Output is correct |
49 |
Correct |
2 ms |
2644 KB |
Output is correct |
50 |
Correct |
2 ms |
2644 KB |
Output is correct |
51 |
Correct |
2 ms |
2644 KB |
Output is correct |
52 |
Correct |
2 ms |
2644 KB |
Output is correct |
53 |
Correct |
2 ms |
2644 KB |
Output is correct |
54 |
Correct |
2 ms |
2692 KB |
Output is correct |
55 |
Correct |
2 ms |
2644 KB |
Output is correct |
56 |
Correct |
2 ms |
2644 KB |
Output is correct |
57 |
Correct |
2 ms |
2644 KB |
Output is correct |
58 |
Correct |
2 ms |
2644 KB |
Output is correct |
59 |
Correct |
2 ms |
2692 KB |
Output is correct |
60 |
Correct |
2 ms |
2644 KB |
Output is correct |
61 |
Correct |
2 ms |
2692 KB |
Output is correct |
62 |
Correct |
2 ms |
2644 KB |
Output is correct |
63 |
Correct |
2 ms |
2696 KB |
Output is correct |
64 |
Correct |
2 ms |
2644 KB |
Output is correct |
65 |
Correct |
2 ms |
2644 KB |
Output is correct |
66 |
Correct |
2 ms |
2644 KB |
Output is correct |
67 |
Correct |
2 ms |
2644 KB |
Output is correct |
68 |
Correct |
2 ms |
2644 KB |
Output is correct |
69 |
Correct |
2 ms |
2644 KB |
Output is correct |
70 |
Correct |
2 ms |
2644 KB |
Output is correct |
71 |
Correct |
1 ms |
2644 KB |
Output is correct |
72 |
Correct |
2 ms |
2688 KB |
Output is correct |
73 |
Correct |
2 ms |
2644 KB |
Output is correct |
74 |
Correct |
2 ms |
2772 KB |
Output is correct |
75 |
Correct |
3 ms |
2644 KB |
Output is correct |
76 |
Correct |
2 ms |
2644 KB |
Output is correct |
77 |
Correct |
2 ms |
2644 KB |
Output is correct |
78 |
Correct |
2 ms |
2692 KB |
Output is correct |
79 |
Correct |
2 ms |
2644 KB |
Output is correct |
80 |
Correct |
2 ms |
2644 KB |
Output is correct |
81 |
Correct |
2 ms |
2692 KB |
Output is correct |
82 |
Correct |
2 ms |
2644 KB |
Output is correct |
83 |
Correct |
2 ms |
2644 KB |
Output is correct |
84 |
Correct |
2 ms |
2644 KB |
Output is correct |
85 |
Correct |
2 ms |
2652 KB |
Output is correct |
86 |
Correct |
2 ms |
2684 KB |
Output is correct |
87 |
Correct |
2 ms |
2644 KB |
Output is correct |
88 |
Correct |
2 ms |
2644 KB |
Output is correct |
89 |
Correct |
2 ms |
2644 KB |
Output is correct |
90 |
Correct |
2 ms |
2644 KB |
Output is correct |
91 |
Correct |
2 ms |
2644 KB |
Output is correct |
92 |
Correct |
1 ms |
2644 KB |
Output is correct |
93 |
Correct |
2 ms |
2644 KB |
Output is correct |
94 |
Correct |
2 ms |
2652 KB |
Output is correct |
95 |
Correct |
2 ms |
2644 KB |
Output is correct |
96 |
Correct |
2 ms |
2696 KB |
Output is correct |
97 |
Correct |
3 ms |
2900 KB |
Output is correct |
98 |
Correct |
3 ms |
2964 KB |
Output is correct |
99 |
Correct |
3 ms |
2964 KB |
Output is correct |
100 |
Correct |
3 ms |
2880 KB |
Output is correct |
101 |
Correct |
3 ms |
2900 KB |
Output is correct |
102 |
Correct |
3 ms |
3028 KB |
Output is correct |
103 |
Correct |
3 ms |
3088 KB |
Output is correct |
104 |
Correct |
3 ms |
3084 KB |
Output is correct |
105 |
Correct |
3 ms |
3028 KB |
Output is correct |
106 |
Correct |
3 ms |
3032 KB |
Output is correct |
107 |
Correct |
3 ms |
3028 KB |
Output is correct |
108 |
Correct |
4 ms |
3028 KB |
Output is correct |
109 |
Correct |
3 ms |
3028 KB |
Output is correct |
110 |
Correct |
4 ms |
2968 KB |
Output is correct |
111 |
Correct |
3 ms |
3028 KB |
Output is correct |
112 |
Correct |
3 ms |
3028 KB |
Output is correct |
113 |
Correct |
3 ms |
3028 KB |
Output is correct |
114 |
Correct |
3 ms |
3028 KB |
Output is correct |
115 |
Correct |
2 ms |
3028 KB |
Output is correct |
116 |
Correct |
3 ms |
2900 KB |
Output is correct |
117 |
Correct |
3 ms |
3028 KB |
Output is correct |
118 |
Correct |
3 ms |
3028 KB |
Output is correct |
119 |
Correct |
3 ms |
3028 KB |
Output is correct |
120 |
Correct |
2 ms |
2900 KB |
Output is correct |
121 |
Correct |
3 ms |
2868 KB |
Output is correct |
122 |
Correct |
3 ms |
2900 KB |
Output is correct |
123 |
Correct |
3 ms |
2900 KB |
Output is correct |
124 |
Correct |
3 ms |
2900 KB |
Output is correct |
125 |
Correct |
3 ms |
2900 KB |
Output is correct |
126 |
Correct |
3 ms |
2900 KB |
Output is correct |
127 |
Correct |
3 ms |
2832 KB |
Output is correct |
128 |
Correct |
3 ms |
2956 KB |
Output is correct |
129 |
Correct |
3 ms |
3028 KB |
Output is correct |
130 |
Correct |
3 ms |
3028 KB |
Output is correct |
131 |
Correct |
3 ms |
3028 KB |
Output is correct |
132 |
Correct |
4 ms |
3028 KB |
Output is correct |
133 |
Correct |
3 ms |
2900 KB |
Output is correct |
134 |
Correct |
3 ms |
2960 KB |
Output is correct |
135 |
Correct |
3 ms |
2900 KB |
Output is correct |
136 |
Correct |
4 ms |
2900 KB |
Output is correct |
137 |
Correct |
2 ms |
2772 KB |
Output is correct |
138 |
Correct |
2 ms |
2772 KB |
Output is correct |
139 |
Correct |
2 ms |
2772 KB |
Output is correct |
140 |
Correct |
2 ms |
2772 KB |
Output is correct |
141 |
Correct |
3 ms |
2804 KB |
Output is correct |
142 |
Correct |
2 ms |
2772 KB |
Output is correct |
143 |
Correct |
2 ms |
2868 KB |
Output is correct |
144 |
Correct |
2 ms |
2772 KB |
Output is correct |
145 |
Correct |
52 ms |
11472 KB |
Output is correct |
146 |
Correct |
54 ms |
11472 KB |
Output is correct |
147 |
Correct |
67 ms |
11460 KB |
Output is correct |
148 |
Correct |
55 ms |
11472 KB |
Output is correct |
149 |
Correct |
51 ms |
11408 KB |
Output is correct |
150 |
Correct |
63 ms |
14612 KB |
Output is correct |
151 |
Correct |
61 ms |
14604 KB |
Output is correct |
152 |
Correct |
55 ms |
14716 KB |
Output is correct |
153 |
Correct |
60 ms |
14668 KB |
Output is correct |
154 |
Correct |
57 ms |
14588 KB |
Output is correct |
155 |
Correct |
56 ms |
13688 KB |
Output is correct |
156 |
Correct |
61 ms |
13636 KB |
Output is correct |
157 |
Correct |
60 ms |
13764 KB |
Output is correct |
158 |
Correct |
57 ms |
13700 KB |
Output is correct |
159 |
Correct |
63 ms |
13732 KB |
Output is correct |
160 |
Correct |
63 ms |
13744 KB |
Output is correct |
161 |
Correct |
55 ms |
13648 KB |
Output is correct |
162 |
Correct |
52 ms |
12892 KB |
Output is correct |
163 |
Correct |
49 ms |
12976 KB |
Output is correct |
164 |
Correct |
48 ms |
10704 KB |
Output is correct |
165 |
Correct |
67 ms |
10700 KB |
Output is correct |
166 |
Correct |
63 ms |
12792 KB |
Output is correct |
167 |
Correct |
53 ms |
12868 KB |
Output is correct |
168 |
Correct |
46 ms |
10564 KB |
Output is correct |
169 |
Correct |
48 ms |
10576 KB |
Output is correct |
170 |
Correct |
47 ms |
10488 KB |
Output is correct |
171 |
Correct |
48 ms |
10576 KB |
Output is correct |
172 |
Correct |
46 ms |
10816 KB |
Output is correct |
173 |
Correct |
49 ms |
10704 KB |
Output is correct |
174 |
Correct |
46 ms |
10720 KB |
Output is correct |
175 |
Correct |
67 ms |
11036 KB |
Output is correct |
176 |
Correct |
57 ms |
10560 KB |
Output is correct |
177 |
Correct |
60 ms |
13764 KB |
Output is correct |
178 |
Correct |
56 ms |
13744 KB |
Output is correct |
179 |
Correct |
52 ms |
13752 KB |
Output is correct |
180 |
Correct |
62 ms |
13780 KB |
Output is correct |
181 |
Correct |
43 ms |
11120 KB |
Output is correct |
182 |
Correct |
41 ms |
11068 KB |
Output is correct |
183 |
Correct |
50 ms |
10836 KB |
Output is correct |
184 |
Correct |
50 ms |
10920 KB |
Output is correct |
185 |
Correct |
30 ms |
8636 KB |
Output is correct |
186 |
Correct |
22 ms |
6980 KB |
Output is correct |
187 |
Correct |
11 ms |
4692 KB |
Output is correct |
188 |
Correct |
55 ms |
11416 KB |
Output is correct |
189 |
Correct |
39 ms |
9304 KB |
Output is correct |
190 |
Correct |
27 ms |
9300 KB |
Output is correct |
191 |
Correct |
14 ms |
6412 KB |
Output is correct |
192 |
Correct |
4 ms |
3540 KB |
Output is correct |