QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#138419#367. Long Mansionjajco#15 233ms37880kbC++173.6kb2023-08-11 18:10:192024-07-04 01:36:58

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 01:36:58]
  • 评测
  • 测评结果:15
  • 用时:233ms
  • 内存:37880kb
  • [2023-08-11 18:10:19]
  • 提交

answer

#include <ios>
#include <set>
#include <vector>
#define INF (int(1e9))
#define REP(i, n) for (int i=0; i<(n); ++i)
#define FOR(i, p, n) for (int i=(p); i<(n); ++i)
#define V std::vector
typedef long long ll;
typedef V <int> vi;
typedef V <ll> vll;
typedef V <bool> vb;
struct stznaj{
    vi t; // min na przedziale
    int comp;
    stznaj(int n, const vi &v){
        comp=1;
        while (comp<n)
            comp<<=1;
        t.resize(comp<<1, INF);
        --comp;
        for (size_t i=0; i<v.size(); ++i)
            t[i+comp+1]=v[i];
        for (int i=comp; i; --i)
            t[i]=std::min(t[i<<1], t[(i<<1)+1]);
    }
    int znaj(int p, int k, int w){
        // najmniejszy index w <p, k>, ze t[comp+i]<w
        ++p,++k;
        int pb=-1,kb=-1;
        for (p+=comp,k+=comp-1; p<k; p>>=1,k>>=1){
            if (p&1){
                if (t[p]<w&&pb<0)
                    pb=p;
                ++p;
            }
            if (k&1){
                --k;
                if (t[k]<w)
                    kb=k;
            }
        }
        if (pb<0)
            pb=kb;
        if (pb<0)
            return -1;
        while (pb<=comp){
            pb<<=1;
            if (t[pb]>=w)
                ++pb;
        }
        return pb-comp-1;
    }
};
struct prz{
    int p,k;
};
int main(){
    int n;
    scanf("%d", &n);
    vi kraw(n-1, -1); // kraw[i] to i->i+1
    REP(i, n-1)
        scanf("%d", &kraw[i]),--kraw[i];
    V <vi> kluzb(n, vi());
    V <std::set <int>> poz(n);
    REP(i, n){
        int l;
        scanf("%d", &l);
        while (l--){
            int p;
            scanf("%d", &p),--p;
            kluzb[i].emplace_back(p);
            poz[p].insert(i);
        }
    } // koniec wczytywania, numery zmapowane na <0,n-1>
    V <prz> wyn(n);
    { // calc wynikowych przedzialow
        vi lprp(n, -1),pprp(n, INF);
        REP(i, n-1){
            // chcemy dojsc do i krawedzia i<->i+1,
            // jak daleko na prawo musimy siegac?
            // i jezeli mamy <p, k>, to mozemy dojsc
            // do i<p, jezeli mozemy dojsc do i+1
            // oraz pprp[i]<=k
            auto itr=poz[kraw[i]].upper_bound(i);
            if (itr!=poz[kraw[i]].end())
                pprp[i]=*itr;
        }
        FOR(i, 1, n){
            // chcemy dojsc do i krawedzia i-1<->i,
            // jak daleko na lewo musimy siegac?
            // i jezeli mamy <p, k>, to mozemy dojsc
            // do i>k, jezeli mozemy dojsc do i-1
            // oraz lprp[i]>=p (-1 jest ok)
            auto itr=poz[kraw[i-1]].lower_bound(i);
            if (itr!=poz[kraw[i-1]].begin()) // czyli niepusty!
                --itr,lprp[i]=*itr;
        }
        // teraz chcemy umiec pytac:
        // "mamy <p, k>, jak daleko w prawo mozemy pojsc?"
        // innymi slowy, jaki jest pierwszy >k ziom 'i'
        // o lprp[i]<p? (lub ze nie istnieje)
        // no to wrzucamy na st z minem na prz i tyle
        stznaj st(n, lprp);
        V <prz> v;
        REP(i, n){
            int p=i,k=st.znaj(p+1, n-1, p);
            k=k<0 ? n-1 : k-1;
            while (v.size()&&pprp[p-1]<=k){
                // laczymy
                p=std::min(v.back().p, p);
                k=std::max(v.back().k, k);
                v.pop_back();
                // rozszerzamy
                k=st.znaj(k+1, n-1, p);
                k=k<0 ? n-1 : k-1;
            }
            prz tmp={p, k};
            wyn[i]=tmp;
            v.push_back(tmp);
        }
    }
    int q;
    scanf("%d", &q);
    while (q--){
        int p,k;
        scanf("%d%d", &p, &k);
        --p,--k;
        bool w=0;
        if ((k>p&&wyn[p].k>=k)||(k<p&&wyn[p].p<=k))
            w=1;
        printf(w ? "YES\n" : "NO\n");
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 2ms
memory: 4268kb

input:

2000
10 7 7 6 12 13 3 13 10 13 10 4 1 12 13 10 10 11 14 9 2 15 15 12 6 1 7 11 14 2 4 12 15 2 4 1 7 3 8 1 10 9 10 9 1 1 3 3 10 8 14 7 15 12 4 15 13 14 13 2 6 9 12 6 12 10 11 9 15 8 15 11 2 7 9 13 14 1 1 10 14 13 13 14 15 6 8 2 1 11 11 5 4 4 13 3 6 6 12 13 1 10 6 1 15 14 6 4 7 4 13 5 1 2 11 1 8 10 7 7...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

ok 5000 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 4244kb

input:

3000
1 4 1 3 3 4 1 2 4 1 2 3 4 2 3 4 4 1 3 1 4 2 2 4 3 3 2 1 3 2 1 3 4 4 3 2 3 2 2 4 4 1 1 3 4 1 4 1 4 1 3 3 4 1 2 1 2 4 2 1 2 1 2 3 3 3 4 2 3 2 1 2 2 1 1 1 1 1 3 3 4 1 4 4 4 4 4 1 2 4 2 2 3 3 4 2 4 3 1 2 4 1 2 1 4 1 4 4 1 3 4 3 1 2 1 3 3 2 1 2 1 2 2 4 3 3 2 4 3 3 3 1 2 1 2 4 4 1 4 1 2 1 4 4 2 2 4 2...

output:

NO
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO...

result:

ok 5000 lines

Test #3:

score: 0
Accepted
time: 4ms
memory: 4460kb

input:

5000
1 2 1 1 2 1 2 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 2 2 2 1 2 1 2 2 2 1 2 2 1 1 1 2 1 2 2 2 1 2 2 2 2 2 2 2 2 1 2 1 1 2 2 2 2 1 2 2 2 1 2 2 2 1 1 1 1 1 2 2 1 2 1 2 2 1 1 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 1 2 2 2 2 2 1 1 1 1 2 2 1 2 2 1 2 1 2 2 1 2 2 1 2 2 2 2 1 1 1 1 2 1 2 1 1 1 1 2 2 2 2 1 1 2 1 1 1...

output:

YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
...

result:

ok 5000 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 4144kb

input:

2000
583 580 319 242 218 934 584 174 18 1224 1376 793 803 842 1430 1269 1442 225 1470 376 1017 352 1081 587 689 582 492 930 918 1266 105 598 1273 343 1047 1499 247 1409 1061 1246 1248 324 1362 1254 208 1448 1438 58 1125 270 1029 355 555 212 881 1232 1093 351 1353 1436 236 498 28 635 187 1439 1257 14...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
...

result:

ok 5000 lines

Test #5:

score: 0
Accepted
time: 2ms
memory: 4424kb

input:

2000
32 16 47 21 12 29 8 37 50 11 22 44 1 17 3 16 19 43 27 23 32 20 28 12 30 36 12 13 24 22 30 7 45 27 33 19 3 7 3 2 33 13 3 40 26 34 42 8 25 42 28 16 48 31 46 43 45 4 37 35 37 46 43 13 3 12 40 20 8 20 47 6 19 3 16 8 21 37 24 30 44 49 34 21 18 41 23 38 13 9 39 50 40 43 17 2 15 31 43 17 8 11 4 41 35 ...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YE...

result:

ok 5000 lines

Test #6:

score: 0
Accepted
time: 2ms
memory: 4240kb

input:

2000
393 319 1075 467 1727 78 1638 314 1362 1450 906 1073 899 1271 1520 1329 1545 170 962 1240 234 1392 593 184 1177 1387 426 130 1896 1179 407 1322 607 1589 1825 1959 1525 1442 499 1177 139 998 682 1095 1944 1626 1161 917 831 1289 553 1406 653 644 1694 1476 1342 451 52 881 1519 1465 792 1544 862 13...

output:

NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
...

result:

ok 5000 lines

Test #7:

score: -5
Wrong Answer
time: 2ms
memory: 4196kb

input:

2000
1600 1598 1596 1594 1592 1590 1588 1586 1584 1582 1580 1578 1576 1574 1572 1570 1568 1566 1564 1562 1560 1558 1556 1554 1552 1550 1548 1546 1544 1542 1540 1538 1536 1534 1532 1530 1528 1526 1524 1522 1520 1518 1516 1514 1512 1510 1508 1506 1504 1502 1500 1498 1496 1494 1492 1490 1488 1486 1484 ...

output:

YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
N...

result:

wrong answer 1405th lines differ - expected: 'NO', found: 'YES'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 15
Accepted

Test #27:

score: 15
Accepted
time: 233ms
memory: 37880kb

input:

100000
2 7 4 20 14 19 16 3 15 15 6 18 12 2 2 16 14 15 2 9 5 16 12 6 10 9 18 6 15 11 7 15 20 7 12 1 12 17 4 19 15 5 6 19 3 1 6 18 19 15 3 1 3 3 16 8 20 20 1 3 3 11 1 4 5 20 10 2 19 9 13 20 11 11 5 9 19 3 19 16 13 7 16 20 8 9 19 14 11 9 9 20 16 20 7 6 13 15 3 4 15 15 4 10 15 3 16 5 18 17 19 7 7 2 10 2...

output:

NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

ok 500000 lines

Test #28:

score: 0
Accepted
time: 221ms
memory: 37272kb

input:

100000
3 2 8 15 7 1 4 11 15 6 10 7 12 2 13 6 2 7 11 10 2 15 2 10 1 4 5 3 1 9 12 4 14 4 11 13 4 7 4 3 6 11 4 11 2 9 15 9 9 2 9 8 3 14 3 13 11 13 2 4 14 8 7 3 3 14 4 10 9 4 1 15 1 13 6 15 6 1 2 2 4 7 7 13 1 12 15 3 4 7 10 13 14 14 11 13 10 4 11 9 6 5 10 2 4 10 6 5 4 11 13 2 15 11 13 11 9 1 7 10 10 13 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YE...

result:

ok 500000 lines

Test #29:

score: 0
Accepted
time: 214ms
memory: 35416kb

input:

100000
4 3 9 4 6 9 4 9 10 2 10 1 3 1 4 3 6 6 9 5 4 7 8 8 2 4 5 9 4 8 2 1 3 6 7 2 9 4 7 4 9 9 5 2 8 3 10 8 7 5 1 2 1 7 9 5 1 3 3 3 2 8 8 1 5 10 6 5 2 4 3 7 6 7 4 2 10 8 7 7 4 7 1 8 6 7 9 1 8 7 8 3 8 6 3 2 7 5 8 1 3 9 6 10 8 8 7 8 1 7 1 3 9 10 9 4 5 5 5 2 8 7 1 1 8 2 8 2 9 7 3 1 1 7 2 1 6 8 9 8 2 1 3 ...

output:

NO
NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
...

result:

ok 500000 lines

Test #30:

score: 0
Accepted
time: 225ms
memory: 37584kb

input:

100000
12 14 16 2 18 6 7 2 18 12 11 14 5 9 14 5 16 3 10 13 6 17 17 8 16 17 8 13 14 4 2 16 8 10 3 11 2 8 14 2 18 9 10 9 13 8 15 11 9 2 16 18 6 8 5 4 6 13 9 2 6 7 18 12 4 5 3 7 2 8 12 17 11 16 3 2 17 6 5 7 1 2 1 16 13 18 13 6 1 12 9 1 18 13 18 6 9 15 2 15 3 10 5 1 16 16 5 17 11 10 9 6 18 5 11 13 10 11...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

ok 500000 lines

Test #31:

score: 0
Accepted
time: 221ms
memory: 37532kb

input:

100000
15 17 8 15 2 2 6 15 11 13 1 3 15 17 14 8 7 9 4 9 13 3 12 3 2 12 10 6 10 12 15 7 4 12 6 15 6 12 8 9 8 11 12 14 11 7 4 17 16 16 2 7 1 5 6 9 1 3 17 16 9 11 10 16 11 4 5 14 5 17 13 12 3 4 17 10 8 10 5 16 6 4 1 4 7 5 10 5 8 11 9 1 6 11 9 9 6 15 7 9 10 15 7 17 7 3 5 6 8 16 15 8 10 9 11 5 4 5 17 15 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 500000 lines

Test #32:

score: 0
Accepted
time: 147ms
memory: 24932kb

input:

100000
19 3 17 13 6 8 11 20 18 20 5 10 15 9 16 11 4 8 11 13 18 4 14 17 11 16 18 11 19 20 1 1 2 19 10 19 8 2 4 6 20 17 14 11 4 4 2 5 19 12 8 7 6 16 12 13 13 10 13 15 15 15 16 6 5 20 20 14 11 4 3 7 20 7 6 2 11 8 4 1 8 19 5 9 2 17 2 8 20 9 20 19 2 5 17 1 17 10 8 18 15 9 13 4 18 20 10 20 9 17 9 13 12 9 ...

output:

NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
Y...

result:

ok 500000 lines

Test #33:

score: 0
Accepted
time: 135ms
memory: 25336kb

input:

100000
14 1 17 17 12 1 12 16 5 20 19 11 9 19 16 19 5 10 13 17 12 8 18 12 4 1 17 1 3 10 3 9 10 7 6 12 9 10 10 11 9 13 18 11 14 2 14 17 20 2 13 15 14 3 12 17 14 8 5 9 12 11 10 17 14 11 16 7 9 1 12 11 18 15 14 12 12 19 7 13 5 10 9 11 8 18 18 17 19 15 2 17 7 2 19 10 2 8 10 10 19 8 9 20 8 16 19 19 9 15 8...

output:

YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YE...

result:

ok 500000 lines

Test #34:

score: 0
Accepted
time: 130ms
memory: 25260kb

input:

100000
18 17 18 13 20 6 1 5 6 6 14 2 11 17 2 8 7 1 7 19 11 6 6 6 16 3 16 5 8 3 6 4 10 9 12 14 5 15 4 3 4 11 1 9 13 17 3 5 5 17 14 4 1 1 4 4 7 11 15 10 18 13 4 9 7 10 5 4 5 16 6 2 6 20 1 11 9 6 15 16 7 15 11 4 17 14 18 13 7 2 1 18 17 10 8 11 15 10 3 15 6 6 11 7 2 1 10 15 11 12 20 10 9 19 7 15 8 17 10...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YE...

result:

ok 500000 lines

Test #35:

score: 0
Accepted
time: 128ms
memory: 25460kb

input:

100000
14 17 6 16 7 14 15 12 20 10 2 9 4 4 2 13 6 15 3 11 13 13 1 3 11 9 18 6 5 10 20 17 5 10 6 12 7 12 12 14 3 18 7 12 8 14 19 8 20 19 19 16 3 1 11 19 20 11 14 4 8 2 15 5 14 11 7 11 13 16 13 1 8 15 12 15 7 4 6 10 20 19 18 17 1 19 20 14 18 17 2 8 15 20 19 1 19 5 12 9 20 11 14 18 7 2 15 5 13 18 3 14 ...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YE...

result:

ok 500000 lines

Test #36:

score: 0
Accepted
time: 140ms
memory: 25352kb

input:

100000
10 12 9 14 15 11 15 14 15 6 10 8 17 17 7 8 6 12 9 13 5 7 12 19 13 17 18 5 13 9 9 8 12 2 10 20 10 7 14 9 3 9 12 18 3 5 7 6 14 6 10 19 15 4 1 12 20 17 6 16 5 18 10 5 14 10 15 12 15 10 3 2 15 11 15 19 20 16 1 11 4 17 8 14 12 11 7 2 6 15 1 8 9 9 4 4 16 13 3 6 2 12 14 1 8 9 18 3 5 16 15 4 7 9 16 1...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 500000 lines

Test #37:

score: 0
Accepted
time: 143ms
memory: 25652kb

input:

100000
3 10 10 17 1 10 1 19 4 9 9 16 11 1 3 7 2 3 17 16 11 1 5 15 18 16 18 8 3 7 14 10 15 17 8 19 9 12 19 2 8 15 15 8 18 19 14 12 4 7 17 10 10 11 3 3 12 6 19 10 19 19 6 4 16 12 18 14 17 11 1 6 1 3 1 18 13 13 5 19 5 1 1 15 18 15 7 3 4 9 16 4 13 1 6 3 16 18 7 17 12 16 13 11 18 1 9 6 3 15 14 6 4 15 5 1...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 500000 lines

Subtask #4:

score: 0
Skipped

Dependency #1:

0%