Submission #986586

# Submission time Handle Problem Language Result Execution time Memory
986586 2024-05-20T20:27:13 Z activedeltorre Interval Collection (CCO20_day2problem2) C++14
11 / 25
7000 ms 252476 KB
#include <iostream>
#include <vector>
#include <set>
#include <map>

using namespace std;
struct ura
{
    int a,b;
};
vector<ura>vecus[500005];
vector<ura>vec;
const int nmax=1000005;
int aint[nmax*4];
int aint2[nmax*4];
int inf=1e9+5;
int inter(int i,int j)
{
    return max(0,min(vec[i].b,vec[j].b)-max(vec[i].a,vec[j].a));
}
int reun(int i,int j)
{
    return max(vec[i].b,vec[j].b)-min(vec[i].a,vec[j].a);
}
long long distsol,cost;
multiset<int>lfend;
multiset<int>rgend;
/// qr1 pe partea dreapta
struct undos
{
    int unde,pozupdate,delacat;
};
vector<undos>oper;
int qr1(int node,int st,int dr,int qst,int qdr)
{
    if(st>qdr || st>dr || qst>dr || qst>qdr)
    {
        return inf;
    }
    if(qst<=st && dr<=qdr)
    {
        return aint[node];
    }
    int mij=(st+dr)/2;
    return min(qr1(node*2,st,mij,qst,qdr),qr1(node*2+1,mij+1,dr,qst,qdr));
}
int qr2(int node,int st,int dr,int qst,int qdr)
{
    if(st>qdr || st>dr || qst>dr || qst>qdr)
    {
        return -inf;
    }
    if(qst<=st && dr<=qdr)
    {
        return aint2[node];
    }
    int mij=(st+dr)/2;
    return max(qr2(node*2,st,mij,qst,qdr),qr2(node*2+1,mij+1,dr,qst,qdr));
}
void update1(int node,int st,int dr,int poz,int val,int smech)
{
    if(st>poz || poz>dr)
    {
        return ;
    }
    if(poz<=st && dr<=poz)
    {
        if(smech==1)
        {
            aint[node]=val;
        }
        else
        {
            oper.push_back({1,poz,aint[node]});
            aint[node]=min(aint[node],val);
        }
        return;
    }
    int mij=(st+dr)/2;
    update1(node*2,st,mij,poz,val,smech);
    update1(node*2+1,mij+1,dr,poz,val,smech);
    aint[node]=min(aint[node*2],aint[node*2+1]);
}
void update2(int node,int st,int dr,int poz,int val,int smech)
{
    if(st>poz || poz>dr)
    {
        return ;
    }
    if(poz<=st && dr<=poz)
    {
        if(smech==1)
        {
            aint2[node]=val;
        }
        else
        {
            oper.push_back({2,poz,aint2[node]});
            aint2[node]=max(aint2[node],val);
        }
        return;
    }
    int mij=(st+dr)/2;
    update2(node*2,st,mij,poz,val,smech);
    update2(node*2+1,mij+1,dr,poz,val,smech);
    aint2[node]=max(aint2[node*2],aint2[node*2+1]);
}
void clr(int node,int st,int dr)
{
    aint2[node]=-inf;
    aint[node]=inf;
    if(st!=dr)
    {
        int mij=(st+dr)/2;
        clr(node*2,st,mij);
        clr(node*2+1,mij+1,dr);
    }
}
multiset<pair<int,int> >solutii;
void undo()
{
    undos a;
    a=oper.back();
    if(a.unde==1)
    {
        update1(1,1,nmax,a.pozupdate,a.delacat,1);
    }
    else if(a.unde==2)
    {
        update2(1,1,nmax,a.pozupdate,a.delacat,1);
    }
    else if(a.unde==3)
    {
        solutii.erase(solutii.find({a.pozupdate,a.delacat}));
    }
    else if(a.unde==4)
    {
        rgend.erase(rgend.find(a.pozupdate));
    }
    else
    {
        lfend.erase(lfend.find(a.pozupdate));
    }
    oper.pop_back();
}
void add(ura x)
{
    int sol=inf,cost=inf,supra=inf,nosupra=inf,supra1=inf,nosupra1=inf;
    if(lfend.size() && x.b>*prev(lfend.end()))
    {
        supra=x.b-*prev(lfend.end());
        nosupra=qr1(1,1,nmax,*prev(lfend.end()),nmax)-x.a;
    }
    else if(lfend.size())
    {
        supra=0;
        nosupra=qr1(1,1,nmax,x.b,nmax)-x.a;
    }
    lfend.insert(x.a);
    update1(1,1,nmax,x.a,x.b,0);
    if(rgend.size() && x.a<=*rgend.begin())
    {
        supra1=*rgend.begin()-x.a;
        nosupra1=x.b-qr2(1,1,nmax,1,*rgend.begin());
    }
    else if(rgend.size())
    {
        supra1=0;
        nosupra1=x.b-qr2(1,1,nmax,1,x.a);
    }
    rgend.insert(x.b);
    update2(1,1,nmax,x.b,x.a,0);
    if(supra1<supra)
    {
        swap(supra1,supra);
        swap(nosupra1,nosupra);
    }
    else if(supra1==supra)
    {
        nosupra=min(nosupra1,nosupra);
    }
    if(supra>x.b-x.a)
    {
        supra=x.b-x.a;
        nosupra=x.b-x.a;
    }
    solutii.insert({supra,nosupra});
    oper.push_back({3,supra,nosupra});
    oper.push_back({4,x.b,0});
    oper.push_back({5,x.a,0});
}
vector<ura>vectorus[nmax*2];
map<pair<int,int>,int>fre;
map<pair<int,int>,int>lst;
void dncadd(int node,int st,int dr,int qst,int qdr,int lf,int rg)
{
    if(st>qdr || st>dr || qst>dr || qst>qdr)
    {
        return ;
    }
    if(qst<=st && dr<=qdr)
    {
        vectorus[node].push_back({lf,rg});
        return;
    }
    int mij=(st+dr)/2;
    dncadd(node*2,st,mij,qst,qdr,lf,rg);
    dncadd(node*2+1,mij+1,dr,qst,qdr,lf,rg);
}
void dfsdnc(int curr,int st,int dr)
{
    int number=oper.size();
    for(int j=0;j<vectorus[curr].size();j++)
    {
        add(vectorus[curr][j]);
    }
    if(st==dr)
    {
        cout<<solutii.begin()->second<<'\n';
    }
    else
    {
        int mij=(st+dr)/2;
        dfsdnc(curr*2,st,mij);
        dfsdnc(curr*2+1,mij+1,dr);
    }
    while(oper.size()>number)
    {
        undo();
    }
}
int main()
{
    int n,i,j,k,l,r,z;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    char tip;
    for(i=1; i<=n; i++)
    {
        cin>>tip;
        if(tip=='A')
        {
            cin>>l>>r;
            fre[{l,r}]++;
            if(fre[{l,r}]==1)
            {
               lst[{l,r}]=i;
            }
        }
        else if(tip=='R')
        {
            cin>>l>>r;
            fre[{l,r}]--;
            if(fre[{l,r}]==0)
            {
                dncadd(1,1,n,lst[{l,r}],i-1,l,r);
            }
        }
        for(j=0; j<vec.size(); j++)
            vecus[i].push_back({vec[j]});
    }
    for(auto j :fre)
    {
        if(j.second!=0)
        {
            dncadd(1,1,n,lst[j.first],n,j.first.first,j.first.second);
        }
    }
    clr(1,1,nmax);
    dfsdnc(1,1,n);
    /*
    for(i=1; i<=n; i++)
    {
        distsol=inf;
        cost=0;
        lfend.clear();
        rgend.clear();
        solutii.clear();
        for(j=0; j<vecus[i].size(); j++)
        {
            add(vecus[i][j]);
        }
        cout<<solutii.begin()->second<<'\n';
        while(oper.size()>0)
        {
            undo();
        }
    }*/
    return 0;
}

Compilation message

Main.cpp: In function 'void add(ura)':
Main.cpp:148:9: warning: unused variable 'sol' [-Wunused-variable]
  148 |     int sol=inf,cost=inf,supra=inf,nosupra=inf,supra1=inf,nosupra1=inf;
      |         ^~~
Main.cpp:148:17: warning: unused variable 'cost' [-Wunused-variable]
  148 |     int sol=inf,cost=inf,supra=inf,nosupra=inf,supra1=inf,nosupra1=inf;
      |                 ^~~~
Main.cpp: In function 'void dfsdnc(int, int, int)':
Main.cpp:213:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<ura>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  213 |     for(int j=0;j<vectorus[curr].size();j++)
      |                 ~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:227:22: warning: comparison of integer expressions of different signedness: 'std::vector<undos>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  227 |     while(oper.size()>number)
      |           ~~~~~~~~~~~^~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:260:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<ura>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  260 |         for(j=0; j<vec.size(); j++)
      |                  ~^~~~~~~~~~~
Main.cpp:234:15: warning: unused variable 'k' [-Wunused-variable]
  234 |     int n,i,j,k,l,r,z;
      |               ^
Main.cpp:234:21: warning: unused variable 'z' [-Wunused-variable]
  234 |     int n,i,j,k,l,r,z;
      |                     ^
# Verdict Execution time Memory Grader output
1 Correct 51 ms 75600 KB Output is correct
2 Correct 42 ms 75600 KB Output is correct
3 Correct 39 ms 75608 KB Output is correct
4 Correct 42 ms 75600 KB Output is correct
5 Correct 42 ms 75724 KB Output is correct
6 Correct 42 ms 75612 KB Output is correct
7 Correct 40 ms 75612 KB Output is correct
8 Correct 40 ms 75556 KB Output is correct
9 Correct 41 ms 75612 KB Output is correct
10 Correct 43 ms 75600 KB Output is correct
11 Correct 41 ms 75612 KB Output is correct
12 Correct 48 ms 75600 KB Output is correct
13 Correct 43 ms 75600 KB Output is correct
14 Correct 42 ms 75612 KB Output is correct
15 Correct 41 ms 75676 KB Output is correct
16 Correct 44 ms 75840 KB Output is correct
17 Correct 44 ms 75736 KB Output is correct
18 Correct 41 ms 75668 KB Output is correct
19 Correct 41 ms 75616 KB Output is correct
20 Correct 40 ms 75616 KB Output is correct
21 Correct 44 ms 75616 KB Output is correct
22 Correct 40 ms 75600 KB Output is correct
23 Correct 40 ms 75520 KB Output is correct
24 Correct 39 ms 75648 KB Output is correct
25 Correct 43 ms 75612 KB Output is correct
26 Correct 41 ms 75596 KB Output is correct
27 Correct 46 ms 75612 KB Output is correct
28 Correct 42 ms 75676 KB Output is correct
29 Correct 44 ms 75604 KB Output is correct
30 Correct 42 ms 75608 KB Output is correct
31 Correct 45 ms 75612 KB Output is correct
32 Correct 43 ms 75764 KB Output is correct
33 Correct 39 ms 75488 KB Output is correct
34 Correct 39 ms 75532 KB Output is correct
35 Correct 44 ms 75624 KB Output is correct
36 Correct 38 ms 75628 KB Output is correct
37 Correct 41 ms 75640 KB Output is correct
38 Correct 41 ms 75604 KB Output is correct
39 Correct 39 ms 75532 KB Output is correct
40 Correct 38 ms 75472 KB Output is correct
41 Correct 41 ms 75720 KB Output is correct
42 Correct 42 ms 75604 KB Output is correct
43 Correct 39 ms 75644 KB Output is correct
44 Correct 40 ms 75428 KB Output is correct
45 Correct 42 ms 75624 KB Output is correct
46 Correct 40 ms 75604 KB Output is correct
47 Correct 39 ms 75604 KB Output is correct
48 Correct 39 ms 75628 KB Output is correct
49 Correct 39 ms 75708 KB Output is correct
50 Correct 43 ms 75612 KB Output is correct
51 Correct 41 ms 75564 KB Output is correct
52 Correct 40 ms 75612 KB Output is correct
53 Correct 43 ms 75740 KB Output is correct
54 Correct 42 ms 75808 KB Output is correct
55 Correct 40 ms 75536 KB Output is correct
56 Correct 40 ms 75612 KB Output is correct
57 Correct 39 ms 75560 KB Output is correct
58 Correct 41 ms 75648 KB Output is correct
59 Correct 41 ms 75600 KB Output is correct
60 Correct 41 ms 75624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 75600 KB Output is correct
2 Correct 42 ms 75600 KB Output is correct
3 Correct 39 ms 75608 KB Output is correct
4 Correct 42 ms 75600 KB Output is correct
5 Correct 42 ms 75724 KB Output is correct
6 Correct 42 ms 75612 KB Output is correct
7 Correct 40 ms 75612 KB Output is correct
8 Correct 40 ms 75556 KB Output is correct
9 Correct 41 ms 75612 KB Output is correct
10 Correct 43 ms 75600 KB Output is correct
11 Correct 41 ms 75612 KB Output is correct
12 Correct 48 ms 75600 KB Output is correct
13 Correct 43 ms 75600 KB Output is correct
14 Correct 42 ms 75612 KB Output is correct
15 Correct 41 ms 75676 KB Output is correct
16 Correct 44 ms 75840 KB Output is correct
17 Correct 44 ms 75736 KB Output is correct
18 Correct 41 ms 75668 KB Output is correct
19 Correct 41 ms 75616 KB Output is correct
20 Correct 40 ms 75616 KB Output is correct
21 Correct 44 ms 75616 KB Output is correct
22 Correct 40 ms 75600 KB Output is correct
23 Correct 40 ms 75520 KB Output is correct
24 Correct 39 ms 75648 KB Output is correct
25 Correct 43 ms 75612 KB Output is correct
26 Correct 41 ms 75596 KB Output is correct
27 Correct 46 ms 75612 KB Output is correct
28 Correct 42 ms 75676 KB Output is correct
29 Correct 44 ms 75604 KB Output is correct
30 Correct 42 ms 75608 KB Output is correct
31 Correct 45 ms 75612 KB Output is correct
32 Correct 43 ms 75764 KB Output is correct
33 Correct 39 ms 75488 KB Output is correct
34 Correct 39 ms 75532 KB Output is correct
35 Correct 44 ms 75624 KB Output is correct
36 Correct 38 ms 75628 KB Output is correct
37 Correct 41 ms 75640 KB Output is correct
38 Correct 41 ms 75604 KB Output is correct
39 Correct 39 ms 75532 KB Output is correct
40 Correct 38 ms 75472 KB Output is correct
41 Correct 41 ms 75720 KB Output is correct
42 Correct 42 ms 75604 KB Output is correct
43 Correct 39 ms 75644 KB Output is correct
44 Correct 40 ms 75428 KB Output is correct
45 Correct 42 ms 75624 KB Output is correct
46 Correct 40 ms 75604 KB Output is correct
47 Correct 39 ms 75604 KB Output is correct
48 Correct 39 ms 75628 KB Output is correct
49 Correct 39 ms 75708 KB Output is correct
50 Correct 43 ms 75612 KB Output is correct
51 Correct 41 ms 75564 KB Output is correct
52 Correct 40 ms 75612 KB Output is correct
53 Correct 43 ms 75740 KB Output is correct
54 Correct 42 ms 75808 KB Output is correct
55 Correct 40 ms 75536 KB Output is correct
56 Correct 40 ms 75612 KB Output is correct
57 Correct 39 ms 75560 KB Output is correct
58 Correct 41 ms 75648 KB Output is correct
59 Correct 41 ms 75600 KB Output is correct
60 Correct 41 ms 75624 KB Output is correct
61 Correct 37 ms 75356 KB Output is correct
62 Correct 38 ms 75348 KB Output is correct
63 Correct 44 ms 75392 KB Output is correct
64 Correct 216 ms 79208 KB Output is correct
65 Correct 163 ms 77884 KB Output is correct
66 Correct 123 ms 77396 KB Output is correct
67 Correct 60 ms 76892 KB Output is correct
68 Correct 212 ms 79224 KB Output is correct
69 Correct 183 ms 77836 KB Output is correct
70 Correct 128 ms 77472 KB Output is correct
71 Correct 102 ms 77244 KB Output is correct
72 Correct 253 ms 80212 KB Output is correct
73 Correct 207 ms 79820 KB Output is correct
74 Correct 218 ms 79880 KB Output is correct
75 Correct 203 ms 79800 KB Output is correct
76 Correct 221 ms 80648 KB Output is correct
77 Correct 221 ms 80620 KB Output is correct
78 Correct 225 ms 80576 KB Output is correct
79 Correct 223 ms 80648 KB Output is correct
80 Correct 216 ms 79248 KB Output is correct
81 Correct 166 ms 77808 KB Output is correct
82 Correct 122 ms 77476 KB Output is correct
83 Correct 63 ms 76908 KB Output is correct
84 Correct 216 ms 79140 KB Output is correct
85 Correct 176 ms 77804 KB Output is correct
86 Correct 139 ms 77272 KB Output is correct
87 Correct 109 ms 77140 KB Output is correct
88 Correct 223 ms 80124 KB Output is correct
89 Correct 204 ms 79760 KB Output is correct
90 Correct 201 ms 79728 KB Output is correct
91 Correct 200 ms 79680 KB Output is correct
92 Correct 224 ms 80728 KB Output is correct
93 Correct 231 ms 80724 KB Output is correct
94 Correct 225 ms 80660 KB Output is correct
95 Correct 228 ms 80944 KB Output is correct
96 Correct 62 ms 76888 KB Output is correct
97 Correct 67 ms 76676 KB Output is correct
98 Correct 61 ms 76880 KB Output is correct
99 Correct 71 ms 76860 KB Output is correct
100 Correct 110 ms 77248 KB Output is correct
101 Correct 103 ms 77132 KB Output is correct
102 Correct 102 ms 77144 KB Output is correct
103 Correct 63 ms 76884 KB Output is correct
104 Correct 204 ms 78992 KB Output is correct
105 Correct 152 ms 77652 KB Output is correct
106 Correct 116 ms 77288 KB Output is correct
107 Correct 65 ms 77080 KB Output is correct
108 Correct 201 ms 78776 KB Output is correct
109 Correct 167 ms 77652 KB Output is correct
110 Correct 117 ms 77136 KB Output is correct
111 Correct 65 ms 76752 KB Output is correct
112 Correct 114 ms 78732 KB Output is correct
113 Correct 122 ms 78800 KB Output is correct
114 Correct 113 ms 78736 KB Output is correct
115 Correct 142 ms 78732 KB Output is correct
116 Correct 115 ms 78732 KB Output is correct
117 Correct 131 ms 79012 KB Output is correct
118 Correct 116 ms 78664 KB Output is correct
119 Correct 129 ms 78664 KB Output is correct
120 Correct 115 ms 78560 KB Output is correct
121 Correct 122 ms 78616 KB Output is correct
122 Correct 178 ms 80624 KB Output is correct
123 Correct 188 ms 80520 KB Output is correct
124 Correct 163 ms 77744 KB Output is correct
125 Correct 127 ms 77136 KB Output is correct
126 Correct 121 ms 77036 KB Output is correct
127 Correct 158 ms 77988 KB Output is correct
128 Correct 126 ms 77136 KB Output is correct
129 Correct 120 ms 77028 KB Output is correct
130 Correct 171 ms 78164 KB Output is correct
131 Correct 125 ms 76988 KB Output is correct
132 Correct 122 ms 77016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 75600 KB Output is correct
2 Correct 42 ms 75600 KB Output is correct
3 Correct 39 ms 75608 KB Output is correct
4 Correct 42 ms 75600 KB Output is correct
5 Correct 42 ms 75724 KB Output is correct
6 Correct 42 ms 75612 KB Output is correct
7 Correct 40 ms 75612 KB Output is correct
8 Correct 40 ms 75556 KB Output is correct
9 Correct 41 ms 75612 KB Output is correct
10 Correct 43 ms 75600 KB Output is correct
11 Correct 41 ms 75612 KB Output is correct
12 Correct 48 ms 75600 KB Output is correct
13 Correct 43 ms 75600 KB Output is correct
14 Correct 42 ms 75612 KB Output is correct
15 Correct 41 ms 75676 KB Output is correct
16 Correct 44 ms 75840 KB Output is correct
17 Correct 44 ms 75736 KB Output is correct
18 Correct 41 ms 75668 KB Output is correct
19 Correct 41 ms 75616 KB Output is correct
20 Correct 40 ms 75616 KB Output is correct
21 Correct 44 ms 75616 KB Output is correct
22 Correct 40 ms 75600 KB Output is correct
23 Correct 40 ms 75520 KB Output is correct
24 Correct 39 ms 75648 KB Output is correct
25 Correct 43 ms 75612 KB Output is correct
26 Correct 41 ms 75596 KB Output is correct
27 Correct 46 ms 75612 KB Output is correct
28 Correct 42 ms 75676 KB Output is correct
29 Correct 44 ms 75604 KB Output is correct
30 Correct 42 ms 75608 KB Output is correct
31 Correct 45 ms 75612 KB Output is correct
32 Correct 43 ms 75764 KB Output is correct
33 Correct 39 ms 75488 KB Output is correct
34 Correct 39 ms 75532 KB Output is correct
35 Correct 44 ms 75624 KB Output is correct
36 Correct 38 ms 75628 KB Output is correct
37 Correct 41 ms 75640 KB Output is correct
38 Correct 41 ms 75604 KB Output is correct
39 Correct 39 ms 75532 KB Output is correct
40 Correct 38 ms 75472 KB Output is correct
41 Correct 41 ms 75720 KB Output is correct
42 Correct 42 ms 75604 KB Output is correct
43 Correct 39 ms 75644 KB Output is correct
44 Correct 40 ms 75428 KB Output is correct
45 Correct 42 ms 75624 KB Output is correct
46 Correct 40 ms 75604 KB Output is correct
47 Correct 39 ms 75604 KB Output is correct
48 Correct 39 ms 75628 KB Output is correct
49 Correct 39 ms 75708 KB Output is correct
50 Correct 43 ms 75612 KB Output is correct
51 Correct 41 ms 75564 KB Output is correct
52 Correct 40 ms 75612 KB Output is correct
53 Correct 43 ms 75740 KB Output is correct
54 Correct 42 ms 75808 KB Output is correct
55 Correct 40 ms 75536 KB Output is correct
56 Correct 40 ms 75612 KB Output is correct
57 Correct 39 ms 75560 KB Output is correct
58 Correct 41 ms 75648 KB Output is correct
59 Correct 41 ms 75600 KB Output is correct
60 Correct 41 ms 75624 KB Output is correct
61 Correct 37 ms 75356 KB Output is correct
62 Correct 38 ms 75348 KB Output is correct
63 Correct 44 ms 75392 KB Output is correct
64 Correct 216 ms 79208 KB Output is correct
65 Correct 163 ms 77884 KB Output is correct
66 Correct 123 ms 77396 KB Output is correct
67 Correct 60 ms 76892 KB Output is correct
68 Correct 212 ms 79224 KB Output is correct
69 Correct 183 ms 77836 KB Output is correct
70 Correct 128 ms 77472 KB Output is correct
71 Correct 102 ms 77244 KB Output is correct
72 Correct 253 ms 80212 KB Output is correct
73 Correct 207 ms 79820 KB Output is correct
74 Correct 218 ms 79880 KB Output is correct
75 Correct 203 ms 79800 KB Output is correct
76 Correct 221 ms 80648 KB Output is correct
77 Correct 221 ms 80620 KB Output is correct
78 Correct 225 ms 80576 KB Output is correct
79 Correct 223 ms 80648 KB Output is correct
80 Correct 216 ms 79248 KB Output is correct
81 Correct 166 ms 77808 KB Output is correct
82 Correct 122 ms 77476 KB Output is correct
83 Correct 63 ms 76908 KB Output is correct
84 Correct 216 ms 79140 KB Output is correct
85 Correct 176 ms 77804 KB Output is correct
86 Correct 139 ms 77272 KB Output is correct
87 Correct 109 ms 77140 KB Output is correct
88 Correct 223 ms 80124 KB Output is correct
89 Correct 204 ms 79760 KB Output is correct
90 Correct 201 ms 79728 KB Output is correct
91 Correct 200 ms 79680 KB Output is correct
92 Correct 224 ms 80728 KB Output is correct
93 Correct 231 ms 80724 KB Output is correct
94 Correct 225 ms 80660 KB Output is correct
95 Correct 228 ms 80944 KB Output is correct
96 Correct 62 ms 76888 KB Output is correct
97 Correct 67 ms 76676 KB Output is correct
98 Correct 61 ms 76880 KB Output is correct
99 Correct 71 ms 76860 KB Output is correct
100 Correct 110 ms 77248 KB Output is correct
101 Correct 103 ms 77132 KB Output is correct
102 Correct 102 ms 77144 KB Output is correct
103 Correct 63 ms 76884 KB Output is correct
104 Correct 204 ms 78992 KB Output is correct
105 Correct 152 ms 77652 KB Output is correct
106 Correct 116 ms 77288 KB Output is correct
107 Correct 65 ms 77080 KB Output is correct
108 Correct 201 ms 78776 KB Output is correct
109 Correct 167 ms 77652 KB Output is correct
110 Correct 117 ms 77136 KB Output is correct
111 Correct 65 ms 76752 KB Output is correct
112 Correct 114 ms 78732 KB Output is correct
113 Correct 122 ms 78800 KB Output is correct
114 Correct 113 ms 78736 KB Output is correct
115 Correct 142 ms 78732 KB Output is correct
116 Correct 115 ms 78732 KB Output is correct
117 Correct 131 ms 79012 KB Output is correct
118 Correct 116 ms 78664 KB Output is correct
119 Correct 129 ms 78664 KB Output is correct
120 Correct 115 ms 78560 KB Output is correct
121 Correct 122 ms 78616 KB Output is correct
122 Correct 178 ms 80624 KB Output is correct
123 Correct 188 ms 80520 KB Output is correct
124 Correct 163 ms 77744 KB Output is correct
125 Correct 127 ms 77136 KB Output is correct
126 Correct 121 ms 77036 KB Output is correct
127 Correct 158 ms 77988 KB Output is correct
128 Correct 126 ms 77136 KB Output is correct
129 Correct 120 ms 77028 KB Output is correct
130 Correct 171 ms 78164 KB Output is correct
131 Correct 125 ms 76988 KB Output is correct
132 Correct 122 ms 77016 KB Output is correct
133 Correct 1024 ms 91200 KB Output is correct
134 Correct 759 ms 85672 KB Output is correct
135 Correct 526 ms 84380 KB Output is correct
136 Correct 181 ms 81744 KB Output is correct
137 Correct 1024 ms 91096 KB Output is correct
138 Correct 790 ms 85632 KB Output is correct
139 Correct 532 ms 83956 KB Output is correct
140 Correct 381 ms 82804 KB Output is correct
141 Correct 1111 ms 95044 KB Output is correct
142 Correct 1031 ms 93784 KB Output is correct
143 Correct 960 ms 93552 KB Output is correct
144 Correct 985 ms 93328 KB Output is correct
145 Correct 1206 ms 97808 KB Output is correct
146 Correct 1097 ms 97680 KB Output is correct
147 Correct 1114 ms 97412 KB Output is correct
148 Correct 1091 ms 97888 KB Output is correct
149 Correct 996 ms 91348 KB Output is correct
150 Correct 748 ms 85652 KB Output is correct
151 Correct 510 ms 83972 KB Output is correct
152 Correct 194 ms 81884 KB Output is correct
153 Correct 1006 ms 90960 KB Output is correct
154 Correct 755 ms 85904 KB Output is correct
155 Correct 509 ms 83712 KB Output is correct
156 Correct 375 ms 82888 KB Output is correct
157 Correct 1063 ms 95100 KB Output is correct
158 Correct 995 ms 93424 KB Output is correct
159 Correct 953 ms 93480 KB Output is correct
160 Correct 925 ms 93448 KB Output is correct
161 Correct 1174 ms 97444 KB Output is correct
162 Correct 1117 ms 97540 KB Output is correct
163 Correct 1104 ms 97556 KB Output is correct
164 Correct 1126 ms 97596 KB Output is correct
165 Correct 141 ms 81156 KB Output is correct
166 Incorrect 136 ms 80964 KB Output isn't correct
167 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3470 ms 164428 KB Output is correct
2 Correct 3446 ms 164244 KB Output is correct
3 Execution timed out 7074 ms 252476 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 75600 KB Output is correct
2 Correct 42 ms 75600 KB Output is correct
3 Correct 39 ms 75608 KB Output is correct
4 Correct 42 ms 75600 KB Output is correct
5 Correct 42 ms 75724 KB Output is correct
6 Correct 42 ms 75612 KB Output is correct
7 Correct 40 ms 75612 KB Output is correct
8 Correct 40 ms 75556 KB Output is correct
9 Correct 41 ms 75612 KB Output is correct
10 Correct 43 ms 75600 KB Output is correct
11 Correct 41 ms 75612 KB Output is correct
12 Correct 48 ms 75600 KB Output is correct
13 Correct 43 ms 75600 KB Output is correct
14 Correct 42 ms 75612 KB Output is correct
15 Correct 41 ms 75676 KB Output is correct
16 Correct 44 ms 75840 KB Output is correct
17 Correct 44 ms 75736 KB Output is correct
18 Correct 41 ms 75668 KB Output is correct
19 Correct 41 ms 75616 KB Output is correct
20 Correct 40 ms 75616 KB Output is correct
21 Correct 44 ms 75616 KB Output is correct
22 Correct 40 ms 75600 KB Output is correct
23 Correct 40 ms 75520 KB Output is correct
24 Correct 39 ms 75648 KB Output is correct
25 Correct 43 ms 75612 KB Output is correct
26 Correct 41 ms 75596 KB Output is correct
27 Correct 46 ms 75612 KB Output is correct
28 Correct 42 ms 75676 KB Output is correct
29 Correct 44 ms 75604 KB Output is correct
30 Correct 42 ms 75608 KB Output is correct
31 Correct 45 ms 75612 KB Output is correct
32 Correct 43 ms 75764 KB Output is correct
33 Correct 39 ms 75488 KB Output is correct
34 Correct 39 ms 75532 KB Output is correct
35 Correct 44 ms 75624 KB Output is correct
36 Correct 38 ms 75628 KB Output is correct
37 Correct 41 ms 75640 KB Output is correct
38 Correct 41 ms 75604 KB Output is correct
39 Correct 39 ms 75532 KB Output is correct
40 Correct 38 ms 75472 KB Output is correct
41 Correct 41 ms 75720 KB Output is correct
42 Correct 42 ms 75604 KB Output is correct
43 Correct 39 ms 75644 KB Output is correct
44 Correct 40 ms 75428 KB Output is correct
45 Correct 42 ms 75624 KB Output is correct
46 Correct 40 ms 75604 KB Output is correct
47 Correct 39 ms 75604 KB Output is correct
48 Correct 39 ms 75628 KB Output is correct
49 Correct 39 ms 75708 KB Output is correct
50 Correct 43 ms 75612 KB Output is correct
51 Correct 41 ms 75564 KB Output is correct
52 Correct 40 ms 75612 KB Output is correct
53 Correct 43 ms 75740 KB Output is correct
54 Correct 42 ms 75808 KB Output is correct
55 Correct 40 ms 75536 KB Output is correct
56 Correct 40 ms 75612 KB Output is correct
57 Correct 39 ms 75560 KB Output is correct
58 Correct 41 ms 75648 KB Output is correct
59 Correct 41 ms 75600 KB Output is correct
60 Correct 41 ms 75624 KB Output is correct
61 Correct 37 ms 75356 KB Output is correct
62 Correct 38 ms 75348 KB Output is correct
63 Correct 44 ms 75392 KB Output is correct
64 Correct 216 ms 79208 KB Output is correct
65 Correct 163 ms 77884 KB Output is correct
66 Correct 123 ms 77396 KB Output is correct
67 Correct 60 ms 76892 KB Output is correct
68 Correct 212 ms 79224 KB Output is correct
69 Correct 183 ms 77836 KB Output is correct
70 Correct 128 ms 77472 KB Output is correct
71 Correct 102 ms 77244 KB Output is correct
72 Correct 253 ms 80212 KB Output is correct
73 Correct 207 ms 79820 KB Output is correct
74 Correct 218 ms 79880 KB Output is correct
75 Correct 203 ms 79800 KB Output is correct
76 Correct 221 ms 80648 KB Output is correct
77 Correct 221 ms 80620 KB Output is correct
78 Correct 225 ms 80576 KB Output is correct
79 Correct 223 ms 80648 KB Output is correct
80 Correct 216 ms 79248 KB Output is correct
81 Correct 166 ms 77808 KB Output is correct
82 Correct 122 ms 77476 KB Output is correct
83 Correct 63 ms 76908 KB Output is correct
84 Correct 216 ms 79140 KB Output is correct
85 Correct 176 ms 77804 KB Output is correct
86 Correct 139 ms 77272 KB Output is correct
87 Correct 109 ms 77140 KB Output is correct
88 Correct 223 ms 80124 KB Output is correct
89 Correct 204 ms 79760 KB Output is correct
90 Correct 201 ms 79728 KB Output is correct
91 Correct 200 ms 79680 KB Output is correct
92 Correct 224 ms 80728 KB Output is correct
93 Correct 231 ms 80724 KB Output is correct
94 Correct 225 ms 80660 KB Output is correct
95 Correct 228 ms 80944 KB Output is correct
96 Correct 62 ms 76888 KB Output is correct
97 Correct 67 ms 76676 KB Output is correct
98 Correct 61 ms 76880 KB Output is correct
99 Correct 71 ms 76860 KB Output is correct
100 Correct 110 ms 77248 KB Output is correct
101 Correct 103 ms 77132 KB Output is correct
102 Correct 102 ms 77144 KB Output is correct
103 Correct 63 ms 76884 KB Output is correct
104 Correct 204 ms 78992 KB Output is correct
105 Correct 152 ms 77652 KB Output is correct
106 Correct 116 ms 77288 KB Output is correct
107 Correct 65 ms 77080 KB Output is correct
108 Correct 201 ms 78776 KB Output is correct
109 Correct 167 ms 77652 KB Output is correct
110 Correct 117 ms 77136 KB Output is correct
111 Correct 65 ms 76752 KB Output is correct
112 Correct 114 ms 78732 KB Output is correct
113 Correct 122 ms 78800 KB Output is correct
114 Correct 113 ms 78736 KB Output is correct
115 Correct 142 ms 78732 KB Output is correct
116 Correct 115 ms 78732 KB Output is correct
117 Correct 131 ms 79012 KB Output is correct
118 Correct 116 ms 78664 KB Output is correct
119 Correct 129 ms 78664 KB Output is correct
120 Correct 115 ms 78560 KB Output is correct
121 Correct 122 ms 78616 KB Output is correct
122 Correct 178 ms 80624 KB Output is correct
123 Correct 188 ms 80520 KB Output is correct
124 Correct 163 ms 77744 KB Output is correct
125 Correct 127 ms 77136 KB Output is correct
126 Correct 121 ms 77036 KB Output is correct
127 Correct 158 ms 77988 KB Output is correct
128 Correct 126 ms 77136 KB Output is correct
129 Correct 120 ms 77028 KB Output is correct
130 Correct 171 ms 78164 KB Output is correct
131 Correct 125 ms 76988 KB Output is correct
132 Correct 122 ms 77016 KB Output is correct
133 Correct 1024 ms 91200 KB Output is correct
134 Correct 759 ms 85672 KB Output is correct
135 Correct 526 ms 84380 KB Output is correct
136 Correct 181 ms 81744 KB Output is correct
137 Correct 1024 ms 91096 KB Output is correct
138 Correct 790 ms 85632 KB Output is correct
139 Correct 532 ms 83956 KB Output is correct
140 Correct 381 ms 82804 KB Output is correct
141 Correct 1111 ms 95044 KB Output is correct
142 Correct 1031 ms 93784 KB Output is correct
143 Correct 960 ms 93552 KB Output is correct
144 Correct 985 ms 93328 KB Output is correct
145 Correct 1206 ms 97808 KB Output is correct
146 Correct 1097 ms 97680 KB Output is correct
147 Correct 1114 ms 97412 KB Output is correct
148 Correct 1091 ms 97888 KB Output is correct
149 Correct 996 ms 91348 KB Output is correct
150 Correct 748 ms 85652 KB Output is correct
151 Correct 510 ms 83972 KB Output is correct
152 Correct 194 ms 81884 KB Output is correct
153 Correct 1006 ms 90960 KB Output is correct
154 Correct 755 ms 85904 KB Output is correct
155 Correct 509 ms 83712 KB Output is correct
156 Correct 375 ms 82888 KB Output is correct
157 Correct 1063 ms 95100 KB Output is correct
158 Correct 995 ms 93424 KB Output is correct
159 Correct 953 ms 93480 KB Output is correct
160 Correct 925 ms 93448 KB Output is correct
161 Correct 1174 ms 97444 KB Output is correct
162 Correct 1117 ms 97540 KB Output is correct
163 Correct 1104 ms 97556 KB Output is correct
164 Correct 1126 ms 97596 KB Output is correct
165 Correct 141 ms 81156 KB Output is correct
166 Incorrect 136 ms 80964 KB Output isn't correct
167 Halted 0 ms 0 KB -