Submission #259831

# Submission time Handle Problem Language Result Execution time Memory
259831 2020-08-08T15:53:23 Z MarcoMeijer Building Skyscrapers (CEOI19_skyscrapers) C++14
61 / 100
3500 ms 63864 KB
#include <bits/stdc++.h>
using namespace std;

// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define FOR(a,b) for(auto& a : b)
#define all(a) a.begin(), a.end()
#define INF 1e9
#define EPS 1e-9
#define pb push_back
#define popb pop_back
#define fi first
#define se second
#define sz size()

// input
template<class T> void IN(T& x) {cin >> x;}
template<class H, class... T> void IN(H& h, T&... t) {IN(h); IN(t...); }

// output
template<class T1, class T2> void OUT(const pair<T1,T2>& x);
template<class T> void OUT(const T& x) {cout << x;}
template<class H, class... T> void OUT(const H& h, const T&... t) {OUT(h); OUT(t...); }
template<class T1, class T2> void OUT(const pair<T1,T2>& x) {OUT(x.fi," ",x.se);}
template<class... T> void OUTL(const T&... t) {OUT(t..., "\n"); }

//===================//
//  Added libraries  //
//===================//

//===================//
//end added libraries//
//===================//

void program();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    program();
}


//===================//
//   begin program   //
//===================//

const int MX = 14e5;

int dx4[]={-1,0,1,0};
int dy4[]={0,1,0,-1};
int dx8[]={ 0, 1, 1, 1, 0,-1,-1,-1};
int dy8[]={ 1, 1, 0,-1,-1,-1, 0, 1};

int n, t, m;
int R[MX], C[MX];
bitset<MX> visited;
set<ii> hasEmptyConnected;
map<ii,int> posID;
map<ii,int> f;
set<ii> build;
set<ii> out;
set<int> pq;
vi ans;
int outside;
set<ii> updateDestroy;

int p[MX], r[MX];
void buildDSU(int dsuSize) {
    RE(i,dsuSize) p[i]=i, r[i]=0;
}
int getSet(int i) {return i==p[i]?i:p[i]=getSet(p[i]);}
bool isSameSet(int i, int j) {return getSet(i)==getSet(j);}
void unionSet(int i, int j) {
    if(!isSameSet(i,j)) {
        i=p[i], j=p[j];
        if(r[i] > r[j]) {
            p[j] = i;
        } else {
            p[i] = j;
            if(r[i] == r[j]) r[j]++;
        }
    }
}

bool canDestroy(ii p) {
    if(!hasEmptyConnected.count(p)) return 0;
    int x=p.fi, y=p.se;

    int start=0;
    bool isBuild[8];
    RE(d,8) {
        int nx=x+dx8[d];
        int ny=y+dy8[d];
        isBuild[d] = build.count({nx,ny});
        if(isBuild[d]) {
            start = d;
        }
    }
    RE(d,4) {
        int cd=d*2;
        int nd=(cd+2)%8;
        if(isBuild[cd] && isBuild[nd])
            isBuild[(cd+1)%8]=1;
    }

    set<int> curRegions;
    bool last=1;
    int pos=(start+1)%8;
    while(pos!=start) {
        int nx=x+dx8[pos];
        int ny=y+dy8[pos];
        if(last && !isBuild[pos]) {
            int reg = getSet(posID[{nx,ny}]);
            if(curRegions.count(reg)) return 0;
            curRegions.insert(reg);
        }
        last = isBuild[pos];
        pos=(pos+1)%8;
    }

    return 1;
}
void updateBuild(ii p) {
    if(canDestroy(p)) {
        pq.insert(f[p]);
    } else {
        pq.erase(f[p]);
    }
}
void addOutside(ii p) {
    if(out.count(p)) return;
    int x=p.fi, y=p.se;
    bitset<8> isBuild;
    RE(d,8) {
        int nx=x+dx8[d];
        int ny=y+dy8[d];
        isBuild[d] = build.count({nx,ny});
    }
    if(!isBuild.count()) return;

    out.insert(p);
    RE(d,4) {
        int nx=x+dx8[d*2];
        int ny=y+dy8[d*2];
        if(!isBuild[d*2])
            addOutside({nx,ny});
        else
            hasEmptyConnected.insert({nx,ny});
    }
    RE(d,8) {
        int nx=x+dx8[d];
        int ny=y+dy8[d];
        if(isBuild[d])
            updateDestroy.insert({nx,ny});
    }
}

void dfsPossible(ii p) {
    if(!build.count(p)) return;
    if(visited[f[p]]) return;
    visited[f[p]] = 1;
    int x=p.fi, y=p.se;
    RE(d,8) {
        int nx=x+dx8[d];
        int ny=y+dy8[d];
        dfsPossible({nx,ny});
    }
}
bool isPossible() {
    visited.reset();
    dfsPossible({R[1],C[1]});
    RE1(i,n) if(!visited[i]) return 0;
    return 1;
}

void addPossible(ii p) {
    if(posID.count(p)) return;
    int res = posID.sz;
    posID[p] = res;
}

void program() {
    IN(n,t);
    RE1(i,n) IN(R[i],C[i]);
    RE1(i,n) build.insert({R[i],C[i]});
    RE1(i,n) f[{R[i],C[i]}]=i;

    // set outside(if there is a solution)
    if(isPossible()) {
        // create dsu
        RE1(i,n) {
            int x=R[i], y=C[i];
            RE(d,8) {
                int nx=x+dx8[d];
                int ny=y+dy8[d];
                addPossible({nx,ny});
            }
            addPossible({x,y});
        }
        m = posID.sz;
        buildDSU(m);
        FOR(p,posID) {
            int x = p.fi.fi;
            int y = p.fi.se;
            if(build.count({x,y})) continue;
            RE(d,4) {
                int nx=x+dx4[d];
                int ny=y+dy4[d];
                if(build.count({nx,ny})) continue;
                if(!posID.count({nx,ny})) continue;
                unionSet(p.se, posID[{nx,ny}]);
            }
        }

        ii start = *build.begin();
        start.fi--;
        outside = posID[start];
        addOutside(start);
        FOR(p,updateDestroy) updateBuild(p);
        updateDestroy.clear();
    }

    // find solution
    while(!pq.empty()) {
        int p = *(--pq.end());
        int x = R[p];
        int y = C[p];
        pq.erase(p);
        build.erase({x,y});

        // update dsu
        RE(d,4) {
            int nx=x+dx4[d];
            int ny=y+dy4[d];
            if(build.count({nx,ny})) continue;
            if(!posID.count({nx,ny})) continue;
            unionSet(posID[{x,y}], posID[{nx,ny}]);
        }

        addOutside({R[p],C[p]});
        FOR(p,updateDestroy) updateBuild(p);
        updateDestroy.clear();
        ans.pb(p);
    }

    if(ans.sz == n) {
        OUTL("YES");
        reverse(all(ans));
        FOR(i,ans) OUTL(i);
    } else {
        OUTL("NO");
    }
}

Compilation message

skyscrapers.cpp: In function 'void program()':
skyscrapers.cpp:261:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(ans.sz == n) {
        ~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB ans=YES N=1
2 Correct 0 ms 512 KB ans=YES N=4
3 Correct 1 ms 512 KB ans=NO N=4
4 Correct 1 ms 512 KB ans=YES N=5
5 Correct 1 ms 512 KB ans=YES N=9
6 Correct 0 ms 512 KB ans=YES N=5
7 Correct 0 ms 512 KB ans=NO N=9
8 Correct 0 ms 512 KB ans=NO N=10
9 Correct 1 ms 512 KB ans=YES N=10
10 Correct 1 ms 512 KB ans=YES N=10
11 Correct 1 ms 512 KB ans=YES N=10
12 Correct 1 ms 512 KB ans=YES N=9
13 Correct 1 ms 512 KB ans=YES N=9
14 Correct 1 ms 512 KB ans=YES N=8
15 Correct 1 ms 512 KB ans=YES N=8
16 Correct 1 ms 512 KB ans=NO N=2
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB ans=YES N=1
2 Correct 0 ms 512 KB ans=YES N=4
3 Correct 1 ms 512 KB ans=NO N=4
4 Correct 1 ms 512 KB ans=YES N=5
5 Correct 1 ms 512 KB ans=YES N=9
6 Correct 0 ms 512 KB ans=YES N=5
7 Correct 0 ms 512 KB ans=NO N=9
8 Correct 0 ms 512 KB ans=NO N=10
9 Correct 1 ms 512 KB ans=YES N=10
10 Correct 1 ms 512 KB ans=YES N=10
11 Correct 1 ms 512 KB ans=YES N=10
12 Correct 1 ms 512 KB ans=YES N=9
13 Correct 1 ms 512 KB ans=YES N=9
14 Correct 1 ms 512 KB ans=YES N=8
15 Correct 1 ms 512 KB ans=YES N=8
16 Correct 1 ms 512 KB ans=NO N=2
17 Correct 1 ms 512 KB ans=YES N=17
18 Correct 1 ms 512 KB ans=YES N=25
19 Correct 1 ms 512 KB ans=YES N=100
20 Correct 3 ms 640 KB ans=YES N=185
21 Correct 1 ms 512 KB ans=NO N=174
22 Correct 1 ms 512 KB ans=YES N=90
23 Correct 1 ms 512 KB ans=YES N=63
24 Correct 1 ms 512 KB ans=YES N=87
25 Correct 3 ms 640 KB ans=YES N=183
26 Correct 2 ms 640 KB ans=YES N=188
27 Correct 3 ms 640 KB ans=YES N=183
28 Correct 2 ms 640 KB ans=YES N=189
29 Correct 3 ms 640 KB ans=YES N=200
30 Correct 3 ms 768 KB ans=YES N=190
31 Correct 2 ms 640 KB ans=YES N=187
32 Correct 3 ms 640 KB ans=YES N=187
33 Correct 3 ms 640 KB ans=YES N=182
34 Correct 3 ms 640 KB ans=YES N=184
35 Correct 3 ms 640 KB ans=YES N=188
36 Correct 3 ms 640 KB ans=YES N=181
37 Correct 3 ms 640 KB ans=YES N=188
38 Correct 3 ms 640 KB ans=YES N=191
39 Correct 2 ms 640 KB ans=YES N=196
40 Correct 2 ms 640 KB ans=YES N=196
41 Correct 2 ms 640 KB ans=YES N=196
42 Correct 2 ms 640 KB ans=YES N=196
43 Correct 3 ms 640 KB ans=YES N=195
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB ans=YES N=1
2 Correct 0 ms 512 KB ans=YES N=4
3 Correct 1 ms 512 KB ans=NO N=4
4 Correct 1 ms 512 KB ans=YES N=5
5 Correct 1 ms 512 KB ans=YES N=9
6 Correct 0 ms 512 KB ans=YES N=5
7 Correct 0 ms 512 KB ans=NO N=9
8 Correct 0 ms 512 KB ans=NO N=10
9 Correct 1 ms 512 KB ans=YES N=10
10 Correct 1 ms 512 KB ans=YES N=10
11 Correct 1 ms 512 KB ans=YES N=10
12 Correct 1 ms 512 KB ans=YES N=9
13 Correct 1 ms 512 KB ans=YES N=9
14 Correct 1 ms 512 KB ans=YES N=8
15 Correct 1 ms 512 KB ans=YES N=8
16 Correct 1 ms 512 KB ans=NO N=2
17 Correct 1 ms 512 KB ans=YES N=17
18 Correct 1 ms 512 KB ans=YES N=25
19 Correct 1 ms 512 KB ans=YES N=100
20 Correct 3 ms 640 KB ans=YES N=185
21 Correct 1 ms 512 KB ans=NO N=174
22 Correct 1 ms 512 KB ans=YES N=90
23 Correct 1 ms 512 KB ans=YES N=63
24 Correct 1 ms 512 KB ans=YES N=87
25 Correct 3 ms 640 KB ans=YES N=183
26 Correct 2 ms 640 KB ans=YES N=188
27 Correct 3 ms 640 KB ans=YES N=183
28 Correct 2 ms 640 KB ans=YES N=189
29 Correct 3 ms 640 KB ans=YES N=200
30 Correct 3 ms 768 KB ans=YES N=190
31 Correct 2 ms 640 KB ans=YES N=187
32 Correct 3 ms 640 KB ans=YES N=187
33 Correct 3 ms 640 KB ans=YES N=182
34 Correct 3 ms 640 KB ans=YES N=184
35 Correct 3 ms 640 KB ans=YES N=188
36 Correct 3 ms 640 KB ans=YES N=181
37 Correct 3 ms 640 KB ans=YES N=188
38 Correct 3 ms 640 KB ans=YES N=191
39 Correct 2 ms 640 KB ans=YES N=196
40 Correct 2 ms 640 KB ans=YES N=196
41 Correct 2 ms 640 KB ans=YES N=196
42 Correct 2 ms 640 KB ans=YES N=196
43 Correct 3 ms 640 KB ans=YES N=195
44 Correct 2 ms 768 KB ans=NO N=1934
45 Correct 2 ms 768 KB ans=NO N=1965
46 Correct 19 ms 1152 KB ans=YES N=1824
47 Correct 22 ms 1152 KB ans=YES N=1981
48 Correct 20 ms 1152 KB ans=YES N=1814
49 Correct 22 ms 1152 KB ans=YES N=1854
50 Correct 20 ms 1152 KB ans=YES N=1831
51 Correct 24 ms 1152 KB ans=YES N=2000
52 Correct 24 ms 1280 KB ans=YES N=1847
53 Correct 25 ms 1280 KB ans=YES N=1819
54 Correct 21 ms 1152 KB ans=YES N=1986
55 Correct 30 ms 1536 KB ans=YES N=2000
56 Correct 29 ms 1664 KB ans=YES N=1834
57 Correct 30 ms 1656 KB ans=YES N=1860
58 Correct 30 ms 1656 KB ans=YES N=1898
59 Correct 27 ms 1528 KB ans=YES N=1832
60 Correct 31 ms 2176 KB ans=YES N=1929
61 Correct 24 ms 1272 KB ans=YES N=1919
62 Correct 28 ms 1784 KB ans=YES N=1882
63 Correct 31 ms 2176 KB ans=YES N=1922
64 Correct 23 ms 1408 KB ans=YES N=1989
65 Correct 18 ms 1664 KB ans=YES N=1978
66 Correct 22 ms 1664 KB ans=YES N=1867
67 Correct 28 ms 1408 KB ans=YES N=1942
# Verdict Execution time Memory Grader output
1 Correct 3 ms 768 KB ans=NO N=1934
2 Correct 2 ms 768 KB ans=NO N=1965
3 Correct 19 ms 1152 KB ans=YES N=1824
4 Correct 21 ms 1152 KB ans=YES N=1981
5 Correct 19 ms 1152 KB ans=YES N=1814
6 Correct 23 ms 1152 KB ans=YES N=1854
7 Correct 20 ms 1152 KB ans=YES N=1831
8 Correct 23 ms 1152 KB ans=YES N=2000
9 Correct 24 ms 1280 KB ans=YES N=1847
10 Correct 25 ms 1280 KB ans=YES N=1819
11 Correct 22 ms 1152 KB ans=YES N=1986
12 Correct 33 ms 1536 KB ans=YES N=2000
13 Correct 28 ms 1664 KB ans=YES N=1834
14 Correct 30 ms 1656 KB ans=YES N=1860
15 Correct 30 ms 1664 KB ans=YES N=1898
16 Correct 27 ms 1532 KB ans=YES N=1832
17 Correct 31 ms 2176 KB ans=YES N=1929
18 Correct 27 ms 1152 KB ans=YES N=1919
19 Correct 28 ms 1664 KB ans=YES N=1882
20 Correct 33 ms 2176 KB ans=YES N=1922
21 Correct 23 ms 1408 KB ans=YES N=1989
22 Correct 18 ms 1664 KB ans=YES N=1978
23 Correct 22 ms 1664 KB ans=YES N=1867
# Verdict Execution time Memory Grader output
1 Correct 0 ms 512 KB ans=YES N=1
2 Correct 0 ms 512 KB ans=YES N=4
3 Correct 1 ms 512 KB ans=NO N=4
4 Correct 1 ms 512 KB ans=YES N=5
5 Correct 1 ms 512 KB ans=YES N=9
6 Correct 0 ms 512 KB ans=YES N=5
7 Correct 0 ms 512 KB ans=NO N=9
8 Correct 0 ms 512 KB ans=NO N=10
9 Correct 1 ms 512 KB ans=YES N=10
10 Correct 1 ms 512 KB ans=YES N=10
11 Correct 1 ms 512 KB ans=YES N=10
12 Correct 1 ms 512 KB ans=YES N=9
13 Correct 1 ms 512 KB ans=YES N=9
14 Correct 1 ms 512 KB ans=YES N=8
15 Correct 1 ms 512 KB ans=YES N=8
16 Correct 1 ms 512 KB ans=NO N=2
17 Correct 1 ms 512 KB ans=YES N=17
18 Correct 1 ms 512 KB ans=YES N=25
19 Correct 1 ms 512 KB ans=YES N=100
20 Correct 3 ms 640 KB ans=YES N=185
21 Correct 1 ms 512 KB ans=NO N=174
22 Correct 1 ms 512 KB ans=YES N=90
23 Correct 1 ms 512 KB ans=YES N=63
24 Correct 1 ms 512 KB ans=YES N=87
25 Correct 3 ms 640 KB ans=YES N=183
26 Correct 2 ms 640 KB ans=YES N=188
27 Correct 3 ms 640 KB ans=YES N=183
28 Correct 2 ms 640 KB ans=YES N=189
29 Correct 3 ms 640 KB ans=YES N=200
30 Correct 3 ms 768 KB ans=YES N=190
31 Correct 2 ms 640 KB ans=YES N=187
32 Correct 3 ms 640 KB ans=YES N=187
33 Correct 3 ms 640 KB ans=YES N=182
34 Correct 3 ms 640 KB ans=YES N=184
35 Correct 3 ms 640 KB ans=YES N=188
36 Correct 3 ms 640 KB ans=YES N=181
37 Correct 3 ms 640 KB ans=YES N=188
38 Correct 3 ms 640 KB ans=YES N=191
39 Correct 2 ms 640 KB ans=YES N=196
40 Correct 2 ms 640 KB ans=YES N=196
41 Correct 2 ms 640 KB ans=YES N=196
42 Correct 2 ms 640 KB ans=YES N=196
43 Correct 3 ms 640 KB ans=YES N=195
44 Correct 2 ms 768 KB ans=NO N=1934
45 Correct 2 ms 768 KB ans=NO N=1965
46 Correct 19 ms 1152 KB ans=YES N=1824
47 Correct 22 ms 1152 KB ans=YES N=1981
48 Correct 20 ms 1152 KB ans=YES N=1814
49 Correct 22 ms 1152 KB ans=YES N=1854
50 Correct 20 ms 1152 KB ans=YES N=1831
51 Correct 24 ms 1152 KB ans=YES N=2000
52 Correct 24 ms 1280 KB ans=YES N=1847
53 Correct 25 ms 1280 KB ans=YES N=1819
54 Correct 21 ms 1152 KB ans=YES N=1986
55 Correct 30 ms 1536 KB ans=YES N=2000
56 Correct 29 ms 1664 KB ans=YES N=1834
57 Correct 30 ms 1656 KB ans=YES N=1860
58 Correct 30 ms 1656 KB ans=YES N=1898
59 Correct 27 ms 1528 KB ans=YES N=1832
60 Correct 31 ms 2176 KB ans=YES N=1929
61 Correct 24 ms 1272 KB ans=YES N=1919
62 Correct 28 ms 1784 KB ans=YES N=1882
63 Correct 31 ms 2176 KB ans=YES N=1922
64 Correct 23 ms 1408 KB ans=YES N=1989
65 Correct 18 ms 1664 KB ans=YES N=1978
66 Correct 22 ms 1664 KB ans=YES N=1867
67 Correct 28 ms 1408 KB ans=YES N=1942
68 Correct 171 ms 11256 KB ans=NO N=66151
69 Correct 62 ms 8056 KB ans=NO N=64333
70 Correct 1183 ms 22512 KB ans=YES N=69316
71 Correct 1178 ms 21768 KB ans=YES N=66695
72 Correct 1217 ms 22484 KB ans=YES N=68436
73 Correct 1210 ms 22780 KB ans=YES N=70000
74 Correct 1169 ms 22516 KB ans=YES N=68501
75 Correct 1328 ms 23280 KB ans=YES N=70000
76 Correct 1292 ms 23284 KB ans=YES N=65009
77 Correct 1732 ms 30612 KB ans=YES N=67007
78 Correct 1825 ms 33564 KB ans=YES N=66357
79 Correct 1927 ms 37792 KB ans=YES N=65430
80 Correct 1947 ms 35116 KB ans=YES N=65790
81 Correct 1884 ms 33384 KB ans=YES N=66020
82 Correct 1736 ms 31592 KB ans=YES N=65809
83 Correct 1523 ms 24180 KB ans=YES N=65651
84 Correct 2009 ms 43528 KB ans=YES N=68040
85 Correct 1887 ms 40304 KB ans=YES N=66570
86 Correct 1222 ms 22132 KB ans=YES N=65421
87 Correct 1335 ms 21288 KB ans=YES N=68351
88 Correct 1174 ms 21872 KB ans=YES N=67027
89 Correct 888 ms 32104 KB ans=YES N=68879
90 Correct 1488 ms 24784 KB ans=YES N=67256
91 Correct 3166 ms 48576 KB ans=YES N=148315
92 Correct 178 ms 17400 KB ans=NO N=142745
93 Correct 209 ms 17912 KB ans=NO N=148443
94 Correct 3126 ms 47696 KB ans=YES N=148328
95 Correct 3198 ms 47660 KB ans=YES N=147855
96 Correct 3092 ms 48184 KB ans=YES N=150000
97 Correct 3041 ms 46496 KB ans=YES N=144725
98 Correct 3078 ms 47748 KB ans=YES N=149445
99 Correct 3040 ms 46420 KB ans=YES N=144455
100 Correct 3030 ms 46164 KB ans=YES N=143487
101 Correct 3078 ms 48264 KB ans=YES N=149688
102 Execution timed out 3588 ms 63864 KB Time limit exceeded
103 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 183 ms 11232 KB ans=NO N=66151
2 Correct 67 ms 8056 KB ans=NO N=64333
3 Correct 1189 ms 22436 KB ans=YES N=69316
4 Correct 1155 ms 21756 KB ans=YES N=66695
5 Correct 1255 ms 22284 KB ans=YES N=68436
6 Correct 1278 ms 22968 KB ans=YES N=70000
7 Correct 1191 ms 22644 KB ans=YES N=68501
8 Correct 1260 ms 23340 KB ans=YES N=70000
9 Correct 1285 ms 23136 KB ans=YES N=65009
10 Correct 1805 ms 30448 KB ans=YES N=67007
11 Correct 1889 ms 33624 KB ans=YES N=66357
12 Correct 1887 ms 37876 KB ans=YES N=65430
13 Correct 1879 ms 35100 KB ans=YES N=65790
14 Correct 2082 ms 33292 KB ans=YES N=66020
15 Correct 1747 ms 31572 KB ans=YES N=65809
16 Correct 1456 ms 24308 KB ans=YES N=65651
17 Correct 2141 ms 43524 KB ans=YES N=68040
18 Correct 1905 ms 40168 KB ans=YES N=66570
19 Correct 1221 ms 22040 KB ans=YES N=65421
20 Correct 1342 ms 21404 KB ans=YES N=68351
21 Correct 1198 ms 21748 KB ans=YES N=67027
22 Correct 898 ms 31856 KB ans=YES N=68879
23 Correct 1488 ms 24788 KB ans=YES N=67256
# Verdict Execution time Memory Grader output
1 Correct 3 ms 768 KB ans=NO N=1934
2 Correct 2 ms 768 KB ans=NO N=1965
3 Correct 19 ms 1152 KB ans=YES N=1824
4 Correct 21 ms 1152 KB ans=YES N=1981
5 Correct 19 ms 1152 KB ans=YES N=1814
6 Correct 23 ms 1152 KB ans=YES N=1854
7 Correct 20 ms 1152 KB ans=YES N=1831
8 Correct 23 ms 1152 KB ans=YES N=2000
9 Correct 24 ms 1280 KB ans=YES N=1847
10 Correct 25 ms 1280 KB ans=YES N=1819
11 Correct 22 ms 1152 KB ans=YES N=1986
12 Correct 33 ms 1536 KB ans=YES N=2000
13 Correct 28 ms 1664 KB ans=YES N=1834
14 Correct 30 ms 1656 KB ans=YES N=1860
15 Correct 30 ms 1664 KB ans=YES N=1898
16 Correct 27 ms 1532 KB ans=YES N=1832
17 Correct 31 ms 2176 KB ans=YES N=1929
18 Correct 27 ms 1152 KB ans=YES N=1919
19 Correct 28 ms 1664 KB ans=YES N=1882
20 Correct 33 ms 2176 KB ans=YES N=1922
21 Correct 23 ms 1408 KB ans=YES N=1989
22 Correct 18 ms 1664 KB ans=YES N=1978
23 Correct 22 ms 1664 KB ans=YES N=1867
24 Correct 183 ms 11232 KB ans=NO N=66151
25 Correct 67 ms 8056 KB ans=NO N=64333
26 Correct 1189 ms 22436 KB ans=YES N=69316
27 Correct 1155 ms 21756 KB ans=YES N=66695
28 Correct 1255 ms 22284 KB ans=YES N=68436
29 Correct 1278 ms 22968 KB ans=YES N=70000
30 Correct 1191 ms 22644 KB ans=YES N=68501
31 Correct 1260 ms 23340 KB ans=YES N=70000
32 Correct 1285 ms 23136 KB ans=YES N=65009
33 Correct 1805 ms 30448 KB ans=YES N=67007
34 Correct 1889 ms 33624 KB ans=YES N=66357
35 Correct 1887 ms 37876 KB ans=YES N=65430
36 Correct 1879 ms 35100 KB ans=YES N=65790
37 Correct 2082 ms 33292 KB ans=YES N=66020
38 Correct 1747 ms 31572 KB ans=YES N=65809
39 Correct 1456 ms 24308 KB ans=YES N=65651
40 Correct 2141 ms 43524 KB ans=YES N=68040
41 Correct 1905 ms 40168 KB ans=YES N=66570
42 Correct 1221 ms 22040 KB ans=YES N=65421
43 Correct 1342 ms 21404 KB ans=YES N=68351
44 Correct 1198 ms 21748 KB ans=YES N=67027
45 Correct 898 ms 31856 KB ans=YES N=68879
46 Correct 1488 ms 24788 KB ans=YES N=67256
47 Correct 3143 ms 48540 KB ans=YES N=148315
48 Correct 197 ms 17272 KB ans=NO N=142745
49 Correct 214 ms 17912 KB ans=NO N=148443
50 Correct 3088 ms 47444 KB ans=YES N=148328
51 Correct 3078 ms 47376 KB ans=YES N=147855
52 Correct 3118 ms 47984 KB ans=YES N=150000
53 Correct 2961 ms 46748 KB ans=YES N=144725
54 Correct 3092 ms 47924 KB ans=YES N=149445
55 Correct 3106 ms 46648 KB ans=YES N=144455
56 Correct 3004 ms 46160 KB ans=YES N=143487
57 Correct 3129 ms 48164 KB ans=YES N=149688
58 Execution timed out 3588 ms 63804 KB Time limit exceeded
59 Halted 0 ms 0 KB -