#include "closing.h"
#include<bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 10;
const int inf1 = 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxn = 2e5+10;
vector<int> line;
int wline;
int n, distx[maxn], disty[maxn], isline[maxn];
vector<pair<int,int>> g[maxn];
int makeline(int u, int ant, int final) {
line.pb(u);
if(u == final) {
return 1;
}
for(auto V : g[u]) if(V.fr != ant) {
int v = V.fr;
int w = V.sc;
if(makeline(v,u,final) == 1) {
wline+= w;
return 1;
}
}
line.pop_back();
return 0;
}
void makedistx(int u, int ant, int dis) {
distx[u] = dis;
for(auto V : g[u]) if(V.fr != ant) {
int v = V.fr;
int w = V.sc;
makedistx(v,u,dis+w);
}
}
void makedisty(int u, int ant, int dis) {
disty[u] = dis;
for(auto V : g[u]) if(V.fr != ant) {
int v = V.fr;
int w = V.sc;
makedisty(v,u,dis+w);
}
}
int32_t max_score(int32_t N, int32_t X, int32_t Y, long long K,
std::vector<int32_t> U, std::vector<int32_t> V, std::vector<int32_t> W)
{
line.clear();
wline = 0;
n = N;
for(int i = 0; i < N; i++) {
isline[i] = distx[i] = disty[i] = 0;
g[i].clear();
}
for(int i = 0; i < U.size(); i++) {
int u = U[i];
int v = V[i];
int w = W[i];
g[u].pb(mp(v,w));
g[v].pb(mp(u,w));
}
makeline(X,-1,Y);
// line[0] = X
// line[line.size()-1] = Y
for(auto x : line) isline[x] = 1;
makedistx(X,-1,0);
makedisty(Y,-1,0);
int mx,my;
for(int i = 0; i+1 < line.size(); i++) {
if(distx[line[i+1]] > disty[line[i+1]]) {
mx = line[i];
my = line[i+1];
break;
}
}
int ans = 0;
{
priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>> pq;
int curk = 0;
vector<int> atvx(n,0), atvy(n,0);
atvx[X] = 1;
atvy[Y] = 1;
for(int u = 0; u < n; u++) {
curk+= max(atvx[u]*distx[u],atvy[u]*disty[u]);
}
for(auto V : g[X]) {
int v = V.fr;
if(atvx[v] == 0 and v != my) {
pq.push(mp(distx[v],mp(v,0)));
}
}
for(auto V : g[Y]) {
int v = V.fr;
if(atvy[v] == 0 and v != mx) {
pq.push(mp(disty[v],mp(v,1)));
}
}
while(pq.size()) {
int tp = pq.top().sc.sc;
int u = pq.top().sc.fr;
pq.pop();
if(tp == 0) {
if(curk+distx[u] <= K) {
atvx[u] = 1;
curk+= distx[u];
for(auto V : g[u]) {
int v = V.fr;
if(atvx[v] == 0 and v != my) {
pq.push(mp(distx[v],mp(v,0)));
}
}
}
}
else {
if(curk+disty[u] <= K) {
atvy[u] = 1;
curk+= disty[u];
for(auto V : g[u]) {
int v = V.fr;
if(atvy[v] == 0 and v != mx) {
pq.push(mp(disty[v],mp(v,1)));
}
}
}
}
}
if(curk <= K) {
int qtd = 0;
for(int i = 0; i < n; i++) {
qtd+= atvx[i];
qtd+= atvy[i];
}
ans = max(ans,qtd);
}
}
{
// os X vai ate mx e Y vai ate my, e continua dai
vector<vector<int>> dpqtd(n), dpqtd1(n);
for(auto r : line) {
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
pq.push(mp(min(distx[r],disty[r]),r));
dpqtd[r].pb(0);
// cout << r << endl;
while(pq.size()) {
int u = pq.top().sc;
pq.pop();
dpqtd[r].pb(dpqtd[r].back()+min(distx[u],disty[u]));
// cout << " " << u << " " << dpqtd[r].size() << " " << dpqtd[r].back() << endl;
for(auto V : g[u]) {
int v = V.fr;
if(isline[v] == 0 and min(distx[u],disty[u]) < min(distx[v],disty[v])) {
pq.push(mp(min(distx[v],disty[v]),v));
}
}
}
int subsize = (int) dpqtd[r].size()-1;
dpqtd1[r].resize(2*subsize+1,inf);
// for(int i = 0; i <= subsize; i++) {
// for(int j = 0; j <= i; j++) {
// dpqtd1[r][i+j] = min(dpqtd1[r][i+j],dpqtd[r][i]+j*(max(distx[r],disty[r])-min(distx[r],disty[r])));
// }
// }
int i = 0;
for(int ij = 0; ij <= 2*subsize; ij++) {
while(i+1 <= ij and i+1 <= subsize and ((ij-i) > i or
dpqtd[r][i]+(ij-i)*(max(distx[r],disty[r])-min(distx[r],disty[r])) > dpqtd[r][i+1]+(ij-i-1)*(max(distx[r],disty[r])-min(distx[r],disty[r])))) {
i++;
}
dpqtd1[r][ij] = dpqtd[r][i]+(ij-i)*(max(distx[r],disty[r])-min(distx[r],disty[r]));
// cout << ij << " - " << i << endl;
}
for(int i = 0; i < dpqtd1[r].size(); i++) {
// cout << " " << i << " " << dpqtd1[r][i] << " " << subsize << endl;
}
}
vector<int> dp;
dp.pb(0);
for(auto r : line) {
vector<int> newdp(dp.size()+dpqtd1[r].size()-1,inf);
for(int i = 0; i < dp.size(); i++) {
for(int j = 1; j < dpqtd1[r].size(); j++) {
newdp[i+j] = min(newdp[i+j],dp[i]+dpqtd1[r][j]);
}
}
dp = newdp;
}
for(int i = 0; i < dp.size(); i++) {
if(dp[i] <= K) {
ans = max(ans,i);
}
}
}
return (int32_t) ans;
}
Compilation message
closing.cpp: In function 'int32_t max_score(int32_t, int32_t, int32_t, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:69:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
69 | for(int i = 0; i < U.size(); i++) {
| ~~^~~~~~~~~~
closing.cpp:84:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
84 | for(int i = 0; i+1 < line.size(); i++) {
| ~~~~^~~~~~~~~~~~~
closing.cpp:204:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
204 | for(int i = 0; i < dpqtd1[r].size(); i++) {
| ~~^~~~~~~~~~~~~~~~~~
closing.cpp:214:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
214 | for(int i = 0; i < dp.size(); i++) {
| ~~^~~~~~~~~~~
closing.cpp:215:34: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
215 | for(int j = 1; j < dpqtd1[r].size(); j++) {
| ~~^~~~~~~~~~~~~~~~~~
closing.cpp:222:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
222 | for(int i = 0; i < dp.size(); i++) {
| ~~^~~~~~~~~~~
closing.cpp:129:41: warning: 'my' may be used uninitialized in this function [-Wmaybe-uninitialized]
129 | if(atvx[v] == 0 and v != my) {
closing.cpp:141:41: warning: 'mx' may be used uninitialized in this function [-Wmaybe-uninitialized]
141 | if(atvy[v] == 0 and v != mx) {
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1068 ms |
48268 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
3 ms |
4956 KB |
Output is correct |
5 |
Correct |
2 ms |
4956 KB |
Output is correct |
6 |
Correct |
3 ms |
4952 KB |
Output is correct |
7 |
Correct |
4 ms |
5148 KB |
Output is correct |
8 |
Correct |
3 ms |
4956 KB |
Output is correct |
9 |
Correct |
2 ms |
4956 KB |
Output is correct |
10 |
Correct |
3 ms |
5144 KB |
Output is correct |
11 |
Correct |
2 ms |
5212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
3 ms |
4956 KB |
Output is correct |
5 |
Correct |
2 ms |
4956 KB |
Output is correct |
6 |
Correct |
3 ms |
4952 KB |
Output is correct |
7 |
Correct |
4 ms |
5148 KB |
Output is correct |
8 |
Correct |
3 ms |
4956 KB |
Output is correct |
9 |
Correct |
2 ms |
4956 KB |
Output is correct |
10 |
Correct |
3 ms |
5144 KB |
Output is correct |
11 |
Correct |
2 ms |
5212 KB |
Output is correct |
12 |
Correct |
2 ms |
4956 KB |
Output is correct |
13 |
Correct |
2 ms |
4956 KB |
Output is correct |
14 |
Correct |
3 ms |
5212 KB |
Output is correct |
15 |
Correct |
3 ms |
5148 KB |
Output is correct |
16 |
Correct |
2 ms |
5040 KB |
Output is correct |
17 |
Correct |
2 ms |
5148 KB |
Output is correct |
18 |
Correct |
3 ms |
4956 KB |
Output is correct |
19 |
Correct |
3 ms |
5212 KB |
Output is correct |
20 |
Correct |
2 ms |
5212 KB |
Output is correct |
21 |
Correct |
3 ms |
5212 KB |
Output is correct |
22 |
Correct |
3 ms |
5212 KB |
Output is correct |
23 |
Correct |
3 ms |
5212 KB |
Output is correct |
24 |
Correct |
3 ms |
5212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
2 ms |
4956 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
3 ms |
4956 KB |
Output is correct |
5 |
Correct |
2 ms |
4956 KB |
Output is correct |
6 |
Correct |
3 ms |
4952 KB |
Output is correct |
7 |
Correct |
4 ms |
5148 KB |
Output is correct |
8 |
Correct |
3 ms |
4956 KB |
Output is correct |
9 |
Correct |
2 ms |
4956 KB |
Output is correct |
10 |
Correct |
3 ms |
5144 KB |
Output is correct |
11 |
Correct |
2 ms |
5212 KB |
Output is correct |
12 |
Correct |
2 ms |
4956 KB |
Output is correct |
13 |
Correct |
2 ms |
4956 KB |
Output is correct |
14 |
Correct |
3 ms |
5212 KB |
Output is correct |
15 |
Correct |
3 ms |
5148 KB |
Output is correct |
16 |
Correct |
2 ms |
5040 KB |
Output is correct |
17 |
Correct |
2 ms |
5148 KB |
Output is correct |
18 |
Correct |
3 ms |
4956 KB |
Output is correct |
19 |
Correct |
3 ms |
5212 KB |
Output is correct |
20 |
Correct |
2 ms |
5212 KB |
Output is correct |
21 |
Correct |
3 ms |
5212 KB |
Output is correct |
22 |
Correct |
3 ms |
5212 KB |
Output is correct |
23 |
Correct |
3 ms |
5212 KB |
Output is correct |
24 |
Correct |
3 ms |
5212 KB |
Output is correct |
25 |
Correct |
5 ms |
5212 KB |
Output is correct |
26 |
Correct |
13 ms |
6004 KB |
Output is correct |
27 |
Correct |
9 ms |
5728 KB |
Output is correct |
28 |
Correct |
25 ms |
5980 KB |
Output is correct |
29 |
Correct |
22 ms |
5980 KB |
Output is correct |
30 |
Correct |
12 ms |
5932 KB |
Output is correct |
31 |
Correct |
27 ms |
6224 KB |
Output is correct |
32 |
Correct |
27 ms |
6236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
3 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
2 ms |
4952 KB |
Output is correct |
8 |
Correct |
2 ms |
5000 KB |
Output is correct |
9 |
Correct |
3 ms |
5056 KB |
Output is correct |
10 |
Correct |
2 ms |
4956 KB |
Output is correct |
11 |
Correct |
2 ms |
4952 KB |
Output is correct |
12 |
Correct |
2 ms |
4956 KB |
Output is correct |
13 |
Correct |
3 ms |
4956 KB |
Output is correct |
14 |
Correct |
2 ms |
4956 KB |
Output is correct |
15 |
Correct |
2 ms |
4956 KB |
Output is correct |
16 |
Correct |
2 ms |
4956 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
2 ms |
4952 KB |
Output is correct |
19 |
Correct |
2 ms |
4956 KB |
Output is correct |
20 |
Correct |
4 ms |
4956 KB |
Output is correct |
21 |
Correct |
2 ms |
4956 KB |
Output is correct |
22 |
Correct |
3 ms |
4956 KB |
Output is correct |
23 |
Correct |
2 ms |
5208 KB |
Output is correct |
24 |
Correct |
2 ms |
5208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
3 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
3 ms |
4952 KB |
Output is correct |
8 |
Correct |
4 ms |
5148 KB |
Output is correct |
9 |
Correct |
3 ms |
4956 KB |
Output is correct |
10 |
Correct |
2 ms |
4956 KB |
Output is correct |
11 |
Correct |
3 ms |
5144 KB |
Output is correct |
12 |
Correct |
2 ms |
5212 KB |
Output is correct |
13 |
Correct |
2 ms |
4956 KB |
Output is correct |
14 |
Correct |
2 ms |
4956 KB |
Output is correct |
15 |
Correct |
3 ms |
5212 KB |
Output is correct |
16 |
Correct |
3 ms |
5148 KB |
Output is correct |
17 |
Correct |
2 ms |
5040 KB |
Output is correct |
18 |
Correct |
2 ms |
5148 KB |
Output is correct |
19 |
Correct |
2 ms |
4952 KB |
Output is correct |
20 |
Correct |
2 ms |
5000 KB |
Output is correct |
21 |
Correct |
3 ms |
5056 KB |
Output is correct |
22 |
Correct |
2 ms |
4956 KB |
Output is correct |
23 |
Correct |
2 ms |
4952 KB |
Output is correct |
24 |
Correct |
2 ms |
4956 KB |
Output is correct |
25 |
Correct |
3 ms |
4956 KB |
Output is correct |
26 |
Correct |
2 ms |
4956 KB |
Output is correct |
27 |
Correct |
2 ms |
4956 KB |
Output is correct |
28 |
Correct |
2 ms |
4956 KB |
Output is correct |
29 |
Correct |
3 ms |
4948 KB |
Output is correct |
30 |
Correct |
2 ms |
4952 KB |
Output is correct |
31 |
Correct |
2 ms |
4956 KB |
Output is correct |
32 |
Correct |
4 ms |
4956 KB |
Output is correct |
33 |
Correct |
2 ms |
4956 KB |
Output is correct |
34 |
Correct |
3 ms |
4956 KB |
Output is correct |
35 |
Correct |
2 ms |
5208 KB |
Output is correct |
36 |
Correct |
2 ms |
5208 KB |
Output is correct |
37 |
Correct |
2 ms |
4956 KB |
Output is correct |
38 |
Correct |
3 ms |
4956 KB |
Output is correct |
39 |
Correct |
2 ms |
4956 KB |
Output is correct |
40 |
Correct |
2 ms |
5152 KB |
Output is correct |
41 |
Correct |
2 ms |
4956 KB |
Output is correct |
42 |
Correct |
2 ms |
4956 KB |
Output is correct |
43 |
Correct |
2 ms |
5212 KB |
Output is correct |
44 |
Correct |
3 ms |
4952 KB |
Output is correct |
45 |
Correct |
3 ms |
5132 KB |
Output is correct |
46 |
Correct |
2 ms |
4956 KB |
Output is correct |
47 |
Correct |
2 ms |
4956 KB |
Output is correct |
48 |
Correct |
2 ms |
4956 KB |
Output is correct |
49 |
Correct |
2 ms |
5012 KB |
Output is correct |
50 |
Correct |
2 ms |
4952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
3 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
3 ms |
4952 KB |
Output is correct |
8 |
Correct |
4 ms |
5148 KB |
Output is correct |
9 |
Correct |
3 ms |
4956 KB |
Output is correct |
10 |
Correct |
2 ms |
4956 KB |
Output is correct |
11 |
Correct |
3 ms |
5144 KB |
Output is correct |
12 |
Correct |
2 ms |
5212 KB |
Output is correct |
13 |
Correct |
2 ms |
4956 KB |
Output is correct |
14 |
Correct |
2 ms |
4956 KB |
Output is correct |
15 |
Correct |
3 ms |
5212 KB |
Output is correct |
16 |
Correct |
3 ms |
5148 KB |
Output is correct |
17 |
Correct |
2 ms |
5040 KB |
Output is correct |
18 |
Correct |
2 ms |
5148 KB |
Output is correct |
19 |
Correct |
3 ms |
4956 KB |
Output is correct |
20 |
Correct |
3 ms |
5212 KB |
Output is correct |
21 |
Correct |
2 ms |
5212 KB |
Output is correct |
22 |
Correct |
3 ms |
5212 KB |
Output is correct |
23 |
Correct |
3 ms |
5212 KB |
Output is correct |
24 |
Correct |
3 ms |
5212 KB |
Output is correct |
25 |
Correct |
3 ms |
5212 KB |
Output is correct |
26 |
Correct |
2 ms |
4952 KB |
Output is correct |
27 |
Correct |
2 ms |
5000 KB |
Output is correct |
28 |
Correct |
3 ms |
5056 KB |
Output is correct |
29 |
Correct |
2 ms |
4956 KB |
Output is correct |
30 |
Correct |
2 ms |
4952 KB |
Output is correct |
31 |
Correct |
2 ms |
4956 KB |
Output is correct |
32 |
Correct |
3 ms |
4956 KB |
Output is correct |
33 |
Correct |
2 ms |
4956 KB |
Output is correct |
34 |
Correct |
2 ms |
4956 KB |
Output is correct |
35 |
Correct |
2 ms |
4956 KB |
Output is correct |
36 |
Correct |
3 ms |
4948 KB |
Output is correct |
37 |
Correct |
2 ms |
4952 KB |
Output is correct |
38 |
Correct |
2 ms |
4956 KB |
Output is correct |
39 |
Correct |
4 ms |
4956 KB |
Output is correct |
40 |
Correct |
2 ms |
4956 KB |
Output is correct |
41 |
Correct |
3 ms |
4956 KB |
Output is correct |
42 |
Correct |
2 ms |
5208 KB |
Output is correct |
43 |
Correct |
2 ms |
5208 KB |
Output is correct |
44 |
Correct |
2 ms |
4956 KB |
Output is correct |
45 |
Correct |
3 ms |
4956 KB |
Output is correct |
46 |
Correct |
2 ms |
4956 KB |
Output is correct |
47 |
Correct |
2 ms |
5152 KB |
Output is correct |
48 |
Correct |
2 ms |
4956 KB |
Output is correct |
49 |
Correct |
2 ms |
4956 KB |
Output is correct |
50 |
Correct |
2 ms |
5212 KB |
Output is correct |
51 |
Correct |
3 ms |
4952 KB |
Output is correct |
52 |
Correct |
3 ms |
5132 KB |
Output is correct |
53 |
Correct |
2 ms |
4956 KB |
Output is correct |
54 |
Correct |
2 ms |
4956 KB |
Output is correct |
55 |
Correct |
2 ms |
4956 KB |
Output is correct |
56 |
Correct |
2 ms |
5012 KB |
Output is correct |
57 |
Correct |
2 ms |
4952 KB |
Output is correct |
58 |
Correct |
2 ms |
4956 KB |
Output is correct |
59 |
Correct |
2 ms |
5152 KB |
Output is correct |
60 |
Correct |
3 ms |
5212 KB |
Output is correct |
61 |
Correct |
3 ms |
5220 KB |
Output is correct |
62 |
Correct |
3 ms |
5464 KB |
Output is correct |
63 |
Correct |
3 ms |
5152 KB |
Output is correct |
64 |
Correct |
3 ms |
5208 KB |
Output is correct |
65 |
Correct |
3 ms |
5212 KB |
Output is correct |
66 |
Correct |
3 ms |
5212 KB |
Output is correct |
67 |
Correct |
2 ms |
5212 KB |
Output is correct |
68 |
Correct |
4 ms |
5208 KB |
Output is correct |
69 |
Correct |
3 ms |
5212 KB |
Output is correct |
70 |
Correct |
3 ms |
5212 KB |
Output is correct |
71 |
Correct |
3 ms |
5216 KB |
Output is correct |
72 |
Correct |
3 ms |
5148 KB |
Output is correct |
73 |
Correct |
3 ms |
5088 KB |
Output is correct |
74 |
Correct |
3 ms |
5216 KB |
Output is correct |
75 |
Correct |
2 ms |
4956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
3 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
3 ms |
4952 KB |
Output is correct |
8 |
Correct |
4 ms |
5148 KB |
Output is correct |
9 |
Correct |
3 ms |
4956 KB |
Output is correct |
10 |
Correct |
2 ms |
4956 KB |
Output is correct |
11 |
Correct |
3 ms |
5144 KB |
Output is correct |
12 |
Correct |
2 ms |
5212 KB |
Output is correct |
13 |
Correct |
2 ms |
4956 KB |
Output is correct |
14 |
Correct |
2 ms |
4956 KB |
Output is correct |
15 |
Correct |
3 ms |
5212 KB |
Output is correct |
16 |
Correct |
3 ms |
5148 KB |
Output is correct |
17 |
Correct |
2 ms |
5040 KB |
Output is correct |
18 |
Correct |
2 ms |
5148 KB |
Output is correct |
19 |
Correct |
3 ms |
4956 KB |
Output is correct |
20 |
Correct |
3 ms |
5212 KB |
Output is correct |
21 |
Correct |
2 ms |
5212 KB |
Output is correct |
22 |
Correct |
3 ms |
5212 KB |
Output is correct |
23 |
Correct |
3 ms |
5212 KB |
Output is correct |
24 |
Correct |
3 ms |
5212 KB |
Output is correct |
25 |
Correct |
3 ms |
5212 KB |
Output is correct |
26 |
Correct |
5 ms |
5212 KB |
Output is correct |
27 |
Correct |
13 ms |
6004 KB |
Output is correct |
28 |
Correct |
9 ms |
5728 KB |
Output is correct |
29 |
Correct |
25 ms |
5980 KB |
Output is correct |
30 |
Correct |
22 ms |
5980 KB |
Output is correct |
31 |
Correct |
12 ms |
5932 KB |
Output is correct |
32 |
Correct |
27 ms |
6224 KB |
Output is correct |
33 |
Correct |
27 ms |
6236 KB |
Output is correct |
34 |
Correct |
2 ms |
4952 KB |
Output is correct |
35 |
Correct |
2 ms |
5000 KB |
Output is correct |
36 |
Correct |
3 ms |
5056 KB |
Output is correct |
37 |
Correct |
2 ms |
4956 KB |
Output is correct |
38 |
Correct |
2 ms |
4952 KB |
Output is correct |
39 |
Correct |
2 ms |
4956 KB |
Output is correct |
40 |
Correct |
3 ms |
4956 KB |
Output is correct |
41 |
Correct |
2 ms |
4956 KB |
Output is correct |
42 |
Correct |
2 ms |
4956 KB |
Output is correct |
43 |
Correct |
2 ms |
4956 KB |
Output is correct |
44 |
Correct |
3 ms |
4948 KB |
Output is correct |
45 |
Correct |
2 ms |
4952 KB |
Output is correct |
46 |
Correct |
2 ms |
4956 KB |
Output is correct |
47 |
Correct |
4 ms |
4956 KB |
Output is correct |
48 |
Correct |
2 ms |
4956 KB |
Output is correct |
49 |
Correct |
3 ms |
4956 KB |
Output is correct |
50 |
Correct |
2 ms |
5208 KB |
Output is correct |
51 |
Correct |
2 ms |
5208 KB |
Output is correct |
52 |
Correct |
2 ms |
4956 KB |
Output is correct |
53 |
Correct |
3 ms |
4956 KB |
Output is correct |
54 |
Correct |
2 ms |
4956 KB |
Output is correct |
55 |
Correct |
2 ms |
5152 KB |
Output is correct |
56 |
Correct |
2 ms |
4956 KB |
Output is correct |
57 |
Correct |
2 ms |
4956 KB |
Output is correct |
58 |
Correct |
2 ms |
5212 KB |
Output is correct |
59 |
Correct |
3 ms |
4952 KB |
Output is correct |
60 |
Correct |
3 ms |
5132 KB |
Output is correct |
61 |
Correct |
2 ms |
4956 KB |
Output is correct |
62 |
Correct |
2 ms |
4956 KB |
Output is correct |
63 |
Correct |
2 ms |
4956 KB |
Output is correct |
64 |
Correct |
2 ms |
5012 KB |
Output is correct |
65 |
Correct |
2 ms |
4952 KB |
Output is correct |
66 |
Correct |
2 ms |
4956 KB |
Output is correct |
67 |
Correct |
2 ms |
5152 KB |
Output is correct |
68 |
Correct |
3 ms |
5212 KB |
Output is correct |
69 |
Correct |
3 ms |
5220 KB |
Output is correct |
70 |
Correct |
3 ms |
5464 KB |
Output is correct |
71 |
Correct |
3 ms |
5152 KB |
Output is correct |
72 |
Correct |
3 ms |
5208 KB |
Output is correct |
73 |
Correct |
3 ms |
5212 KB |
Output is correct |
74 |
Correct |
3 ms |
5212 KB |
Output is correct |
75 |
Correct |
2 ms |
5212 KB |
Output is correct |
76 |
Correct |
4 ms |
5208 KB |
Output is correct |
77 |
Correct |
3 ms |
5212 KB |
Output is correct |
78 |
Correct |
3 ms |
5212 KB |
Output is correct |
79 |
Correct |
3 ms |
5216 KB |
Output is correct |
80 |
Correct |
3 ms |
5148 KB |
Output is correct |
81 |
Correct |
3 ms |
5088 KB |
Output is correct |
82 |
Correct |
3 ms |
5216 KB |
Output is correct |
83 |
Correct |
2 ms |
4956 KB |
Output is correct |
84 |
Correct |
4 ms |
5212 KB |
Output is correct |
85 |
Correct |
5 ms |
5208 KB |
Output is correct |
86 |
Correct |
4 ms |
5212 KB |
Output is correct |
87 |
Correct |
4 ms |
5208 KB |
Output is correct |
88 |
Correct |
4 ms |
5212 KB |
Output is correct |
89 |
Correct |
4 ms |
5724 KB |
Output is correct |
90 |
Correct |
7 ms |
5608 KB |
Output is correct |
91 |
Correct |
15 ms |
5696 KB |
Output is correct |
92 |
Correct |
6 ms |
5720 KB |
Output is correct |
93 |
Correct |
14 ms |
5724 KB |
Output is correct |
94 |
Correct |
26 ms |
6040 KB |
Output is correct |
95 |
Correct |
26 ms |
5976 KB |
Output is correct |
96 |
Correct |
20 ms |
5980 KB |
Output is correct |
97 |
Correct |
19 ms |
5976 KB |
Output is correct |
98 |
Correct |
11 ms |
5720 KB |
Output is correct |
99 |
Correct |
4 ms |
5724 KB |
Output is correct |
100 |
Correct |
4 ms |
5464 KB |
Output is correct |
101 |
Correct |
4 ms |
5208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4956 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
3 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
3 ms |
4952 KB |
Output is correct |
8 |
Correct |
4 ms |
5148 KB |
Output is correct |
9 |
Correct |
3 ms |
4956 KB |
Output is correct |
10 |
Correct |
2 ms |
4956 KB |
Output is correct |
11 |
Correct |
3 ms |
5144 KB |
Output is correct |
12 |
Correct |
2 ms |
5212 KB |
Output is correct |
13 |
Correct |
2 ms |
4956 KB |
Output is correct |
14 |
Correct |
2 ms |
4956 KB |
Output is correct |
15 |
Correct |
3 ms |
5212 KB |
Output is correct |
16 |
Correct |
3 ms |
5148 KB |
Output is correct |
17 |
Correct |
2 ms |
5040 KB |
Output is correct |
18 |
Correct |
2 ms |
5148 KB |
Output is correct |
19 |
Correct |
3 ms |
4956 KB |
Output is correct |
20 |
Correct |
3 ms |
5212 KB |
Output is correct |
21 |
Correct |
2 ms |
5212 KB |
Output is correct |
22 |
Correct |
3 ms |
5212 KB |
Output is correct |
23 |
Correct |
3 ms |
5212 KB |
Output is correct |
24 |
Correct |
3 ms |
5212 KB |
Output is correct |
25 |
Correct |
3 ms |
5212 KB |
Output is correct |
26 |
Correct |
5 ms |
5212 KB |
Output is correct |
27 |
Correct |
13 ms |
6004 KB |
Output is correct |
28 |
Correct |
9 ms |
5728 KB |
Output is correct |
29 |
Correct |
25 ms |
5980 KB |
Output is correct |
30 |
Correct |
22 ms |
5980 KB |
Output is correct |
31 |
Correct |
12 ms |
5932 KB |
Output is correct |
32 |
Correct |
27 ms |
6224 KB |
Output is correct |
33 |
Correct |
27 ms |
6236 KB |
Output is correct |
34 |
Correct |
2 ms |
4952 KB |
Output is correct |
35 |
Correct |
2 ms |
5000 KB |
Output is correct |
36 |
Correct |
3 ms |
5056 KB |
Output is correct |
37 |
Correct |
2 ms |
4956 KB |
Output is correct |
38 |
Correct |
2 ms |
4952 KB |
Output is correct |
39 |
Correct |
2 ms |
4956 KB |
Output is correct |
40 |
Correct |
3 ms |
4956 KB |
Output is correct |
41 |
Correct |
2 ms |
4956 KB |
Output is correct |
42 |
Correct |
2 ms |
4956 KB |
Output is correct |
43 |
Correct |
2 ms |
4956 KB |
Output is correct |
44 |
Correct |
3 ms |
4948 KB |
Output is correct |
45 |
Correct |
2 ms |
4952 KB |
Output is correct |
46 |
Correct |
2 ms |
4956 KB |
Output is correct |
47 |
Correct |
4 ms |
4956 KB |
Output is correct |
48 |
Correct |
2 ms |
4956 KB |
Output is correct |
49 |
Correct |
3 ms |
4956 KB |
Output is correct |
50 |
Correct |
2 ms |
5208 KB |
Output is correct |
51 |
Correct |
2 ms |
5208 KB |
Output is correct |
52 |
Correct |
2 ms |
4956 KB |
Output is correct |
53 |
Correct |
3 ms |
4956 KB |
Output is correct |
54 |
Correct |
2 ms |
4956 KB |
Output is correct |
55 |
Correct |
2 ms |
5152 KB |
Output is correct |
56 |
Correct |
2 ms |
4956 KB |
Output is correct |
57 |
Correct |
2 ms |
4956 KB |
Output is correct |
58 |
Correct |
2 ms |
5212 KB |
Output is correct |
59 |
Correct |
3 ms |
4952 KB |
Output is correct |
60 |
Correct |
3 ms |
5132 KB |
Output is correct |
61 |
Correct |
2 ms |
4956 KB |
Output is correct |
62 |
Correct |
2 ms |
4956 KB |
Output is correct |
63 |
Correct |
2 ms |
4956 KB |
Output is correct |
64 |
Correct |
2 ms |
5012 KB |
Output is correct |
65 |
Correct |
2 ms |
4952 KB |
Output is correct |
66 |
Correct |
2 ms |
4956 KB |
Output is correct |
67 |
Correct |
2 ms |
5152 KB |
Output is correct |
68 |
Correct |
3 ms |
5212 KB |
Output is correct |
69 |
Correct |
3 ms |
5220 KB |
Output is correct |
70 |
Correct |
3 ms |
5464 KB |
Output is correct |
71 |
Correct |
3 ms |
5152 KB |
Output is correct |
72 |
Correct |
3 ms |
5208 KB |
Output is correct |
73 |
Correct |
3 ms |
5212 KB |
Output is correct |
74 |
Correct |
3 ms |
5212 KB |
Output is correct |
75 |
Correct |
2 ms |
5212 KB |
Output is correct |
76 |
Correct |
4 ms |
5208 KB |
Output is correct |
77 |
Correct |
3 ms |
5212 KB |
Output is correct |
78 |
Correct |
3 ms |
5212 KB |
Output is correct |
79 |
Correct |
3 ms |
5216 KB |
Output is correct |
80 |
Correct |
3 ms |
5148 KB |
Output is correct |
81 |
Correct |
3 ms |
5088 KB |
Output is correct |
82 |
Correct |
3 ms |
5216 KB |
Output is correct |
83 |
Correct |
2 ms |
4956 KB |
Output is correct |
84 |
Correct |
4 ms |
5212 KB |
Output is correct |
85 |
Correct |
5 ms |
5208 KB |
Output is correct |
86 |
Correct |
4 ms |
5212 KB |
Output is correct |
87 |
Correct |
4 ms |
5208 KB |
Output is correct |
88 |
Correct |
4 ms |
5212 KB |
Output is correct |
89 |
Correct |
4 ms |
5724 KB |
Output is correct |
90 |
Correct |
7 ms |
5608 KB |
Output is correct |
91 |
Correct |
15 ms |
5696 KB |
Output is correct |
92 |
Correct |
6 ms |
5720 KB |
Output is correct |
93 |
Correct |
14 ms |
5724 KB |
Output is correct |
94 |
Correct |
26 ms |
6040 KB |
Output is correct |
95 |
Correct |
26 ms |
5976 KB |
Output is correct |
96 |
Correct |
20 ms |
5980 KB |
Output is correct |
97 |
Correct |
19 ms |
5976 KB |
Output is correct |
98 |
Correct |
11 ms |
5720 KB |
Output is correct |
99 |
Correct |
4 ms |
5724 KB |
Output is correct |
100 |
Correct |
4 ms |
5464 KB |
Output is correct |
101 |
Correct |
4 ms |
5208 KB |
Output is correct |
102 |
Correct |
93 ms |
10216 KB |
Output is correct |
103 |
Correct |
136 ms |
10416 KB |
Output is correct |
104 |
Execution timed out |
1044 ms |
55840 KB |
Time limit exceeded |
105 |
Halted |
0 ms |
0 KB |
- |