Submission #688423

# Submission time Handle Problem Language Result Execution time Memory
688423 2023-01-27T12:41:40 Z Nelt Cave (IOI13_cave) C++17
100 / 100
971 ms 588 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include "cave.h"
/* DEFINES */
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define ld long double
#define npos ULLONG_MAX
#define INF LLONG_MAX
#define vv(a) vector<a>
#define pp(a, b) pair<a, b>
#define pq(a) priority_queue<a>
#define qq(a) queue<a>
#define ss(a) set<a>
#define mm(a, b) map<a, b>
#define ump(a, b) unordered_map<a, b>
#define sync                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define elif else if
#define endl "\n"
#define allc(a) begin(a), end(a)
#define all(a) a, a + sizeof(a) / sizeof(a[0])
#define pb push_back
#define logi(a) __lg(a)
#define sqrt(a) sqrtl(a)
#define mpr make_pair
#define ins insert
using namespace std;
using namespace __cxx11;
typedef char chr;
typedef basic_string<chr> str;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
void exploreCave(int n)
{
    int d[n], s[n], tmp[n];
    vv(int) v;
    memset(s, -1, sizeof(s));
    memset(d, 0, sizeof(d));
    for (ll i = 0; i < n; i++)
        v.pb(i);
    for (ll i = 0; i < n; i++)
    {
        for (ll j = 0; j < n; j++)
            if (s[j] == -1)
                tmp[j] = 0;
            else
                tmp[j] = s[j];
        ll tp = (tryCombination(tmp) == i), l = 0, r = (ll)v.size() - 1;
        while (l <= r)
        {
            ll mid = (l + r) >> 1, x;
            for (ll j = 0; j < n; j++)
                tmp[j] = s[j];
            for (ll j = 0; j < n; j++)
                if (tmp[v[j]] == -1)
                    tmp[v[j]] = !tp;
            for (ll j = 0; j <= mid; j++)
                tmp[v[j]] = tp;
            x = tryCombination(tmp);
            if (x == -1 or x > i)
                r = mid - 1;
            else
                l = mid + 1;
        }
        d[v[r + 1]] = i;
        s[v[r + 1]] = tp;
        v.erase(v.begin() + r + 1);
    }
    answer(s, d);
}
void solve()
{
    
}
/*

*/
// int main()
// {
//     sync
//         // precomp();
//         ll t = 1;
//     // cin >> t;
//     for (ll i = 1; i <= t; i++)
//         // cout << "Case #" << i << ": ",
//         solve();
//     cerr << "\nTime elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n";
// }
# Verdict Execution time Memory Grader output
1 Correct 381 ms 408 KB Output is correct
2 Correct 378 ms 436 KB Output is correct
3 Correct 572 ms 340 KB Output is correct
4 Correct 374 ms 436 KB Output is correct
5 Correct 605 ms 448 KB Output is correct
6 Correct 555 ms 468 KB Output is correct
7 Correct 609 ms 448 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 578 ms 448 KB Output is correct
13 Correct 582 ms 444 KB Output is correct
14 Correct 564 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 598 ms 448 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 769 ms 448 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 613 ms 480 KB Output is correct
7 Correct 788 ms 480 KB Output is correct
8 Correct 793 ms 484 KB Output is correct
9 Correct 795 ms 484 KB Output is correct
10 Correct 788 ms 480 KB Output is correct
11 Correct 971 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 300 KB Output is correct
17 Correct 1 ms 300 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 134 ms 360 KB Output is correct
21 Correct 1 ms 304 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 115 ms 364 KB Output is correct
24 Correct 102 ms 360 KB Output is correct
25 Correct 110 ms 364 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 91 ms 316 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 96 ms 360 KB Output is correct
31 Correct 134 ms 360 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 110 ms 340 KB Output is correct
36 Correct 111 ms 340 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 381 ms 408 KB Output is correct
2 Correct 378 ms 436 KB Output is correct
3 Correct 572 ms 340 KB Output is correct
4 Correct 374 ms 436 KB Output is correct
5 Correct 605 ms 448 KB Output is correct
6 Correct 555 ms 468 KB Output is correct
7 Correct 609 ms 448 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 578 ms 448 KB Output is correct
13 Correct 582 ms 444 KB Output is correct
14 Correct 564 ms 444 KB Output is correct
15 Correct 598 ms 448 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 769 ms 448 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 613 ms 480 KB Output is correct
21 Correct 788 ms 480 KB Output is correct
22 Correct 793 ms 484 KB Output is correct
23 Correct 795 ms 484 KB Output is correct
24 Correct 788 ms 480 KB Output is correct
25 Correct 971 ms 484 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 304 KB Output is correct
30 Correct 1 ms 304 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 308 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 0 ms 300 KB Output is correct
42 Correct 1 ms 300 KB Output is correct
43 Correct 1 ms 304 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 134 ms 360 KB Output is correct
46 Correct 1 ms 304 KB Output is correct
47 Correct 1 ms 300 KB Output is correct
48 Correct 115 ms 364 KB Output is correct
49 Correct 102 ms 360 KB Output is correct
50 Correct 110 ms 364 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 91 ms 316 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 96 ms 360 KB Output is correct
56 Correct 134 ms 360 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 110 ms 340 KB Output is correct
61 Correct 111 ms 340 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 386 ms 440 KB Output is correct
64 Correct 384 ms 456 KB Output is correct
65 Correct 572 ms 480 KB Output is correct
66 Correct 382 ms 456 KB Output is correct
67 Correct 608 ms 480 KB Output is correct
68 Correct 596 ms 484 KB Output is correct
69 Correct 577 ms 480 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 1 ms 212 KB Output is correct
72 Correct 578 ms 484 KB Output is correct
73 Correct 576 ms 480 KB Output is correct
74 Correct 578 ms 480 KB Output is correct
75 Correct 769 ms 480 KB Output is correct
76 Correct 0 ms 212 KB Output is correct
77 Correct 0 ms 300 KB Output is correct
78 Correct 586 ms 496 KB Output is correct
79 Correct 930 ms 480 KB Output is correct
80 Correct 756 ms 588 KB Output is correct
81 Correct 738 ms 496 KB Output is correct
82 Correct 728 ms 588 KB Output is correct
83 Correct 955 ms 488 KB Output is correct
84 Correct 1 ms 212 KB Output is correct
85 Correct 135 ms 364 KB Output is correct
86 Correct 933 ms 468 KB Output is correct
87 Correct 1 ms 212 KB Output is correct
88 Correct 1 ms 300 KB Output is correct
89 Correct 107 ms 360 KB Output is correct
90 Correct 107 ms 360 KB Output is correct
91 Correct 104 ms 360 KB Output is correct
92 Correct 777 ms 484 KB Output is correct
93 Correct 783 ms 480 KB Output is correct
94 Correct 757 ms 480 KB Output is correct
95 Correct 1 ms 212 KB Output is correct
96 Correct 1 ms 304 KB Output is correct
97 Correct 732 ms 484 KB Output is correct
98 Correct 90 ms 364 KB Output is correct
99 Correct 620 ms 496 KB Output is correct
100 Correct 1 ms 212 KB Output is correct
101 Correct 131 ms 364 KB Output is correct
102 Correct 135 ms 368 KB Output is correct
103 Correct 923 ms 480 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 99 ms 360 KB Output is correct
108 Correct 111 ms 364 KB Output is correct
109 Correct 784 ms 484 KB Output is correct
110 Correct 767 ms 484 KB Output is correct
111 Correct 0 ms 212 KB Output is correct