답안 #597936

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597936 2022-07-17T08:03:03 Z maomao90 Art Collections (BOI22_art) C++17
50 / 100
757 ms 432 KB
// Hallelujah, praise the one who set me free
// Hallelujah, death has lost its grip on me
// You have broken every chain, There's salvation in your name
// Jesus Christ, my living hope
#include <bits/stdc++.h> 
#include "art.h"
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define RREP(i, s, e) for (int i = (s); i >= (e); i--)
template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
typedef long long ll;
typedef long double ld;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define SZ(_a) (int) _a.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;

#ifndef DEBUG
#define cerr if (0) cerr
#endif

const int INF = 1000000005;
const ll LINF = 1000000000000000005ll;
const int MAXN = 4005;

int n;

void solve(int N) {
    n = N;
    vi p(n, 0), id(n, 0);
    iota(ALL(p), 1);
    id = p;
    int b = publish(id);
    stable_sort(ALL(p), [&] (int l, int r) {
            swap(id[l - 1], id[r - 1]);
            int tmp = publish(id);
            swap(id[l - 1], id[r - 1]);
            return tmp < b;
            });
    answer(p);
}

Compilation message

interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 208 KB Output is correct
10 Correct 3 ms 208 KB Output is correct
11 Correct 3 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 2 ms 208 KB Output is correct
20 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 208 KB Output is correct
10 Correct 3 ms 208 KB Output is correct
11 Correct 3 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 2 ms 208 KB Output is correct
20 Correct 2 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 6 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 4 ms 208 KB Output is correct
25 Correct 2 ms 208 KB Output is correct
26 Correct 38 ms 208 KB Output is correct
27 Correct 25 ms 208 KB Output is correct
28 Correct 46 ms 208 KB Output is correct
29 Correct 54 ms 208 KB Output is correct
30 Correct 57 ms 208 KB Output is correct
31 Correct 53 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 1 ms 208 KB Output is correct
38 Correct 3 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 208 KB Output is correct
10 Correct 3 ms 208 KB Output is correct
11 Correct 3 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 2 ms 208 KB Output is correct
20 Correct 2 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 6 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 4 ms 208 KB Output is correct
25 Correct 2 ms 208 KB Output is correct
26 Correct 38 ms 208 KB Output is correct
27 Correct 25 ms 208 KB Output is correct
28 Correct 46 ms 208 KB Output is correct
29 Correct 54 ms 208 KB Output is correct
30 Correct 57 ms 208 KB Output is correct
31 Correct 53 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 1 ms 208 KB Output is correct
38 Correct 3 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 3 ms 208 KB Output is correct
42 Correct 3 ms 208 KB Output is correct
43 Correct 3 ms 208 KB Output is correct
44 Correct 2 ms 208 KB Output is correct
45 Correct 31 ms 208 KB Output is correct
46 Correct 22 ms 208 KB Output is correct
47 Correct 81 ms 208 KB Output is correct
48 Correct 55 ms 208 KB Output is correct
49 Correct 59 ms 208 KB Output is correct
50 Correct 58 ms 208 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Correct 95 ms 208 KB Output is correct
53 Correct 84 ms 208 KB Output is correct
54 Correct 196 ms 208 KB Output is correct
55 Correct 173 ms 208 KB Output is correct
56 Correct 163 ms 208 KB Output is correct
57 Correct 173 ms 208 KB Output is correct
58 Correct 0 ms 208 KB Output is correct
59 Correct 0 ms 208 KB Output is correct
60 Correct 1 ms 208 KB Output is correct
61 Correct 1 ms 208 KB Output is correct
62 Correct 1 ms 208 KB Output is correct
63 Correct 2 ms 208 KB Output is correct
64 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 208 KB Output is correct
10 Correct 3 ms 208 KB Output is correct
11 Correct 3 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 2 ms 208 KB Output is correct
20 Correct 2 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 6 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 4 ms 208 KB Output is correct
25 Correct 2 ms 208 KB Output is correct
26 Correct 38 ms 208 KB Output is correct
27 Correct 25 ms 208 KB Output is correct
28 Correct 46 ms 208 KB Output is correct
29 Correct 54 ms 208 KB Output is correct
30 Correct 57 ms 208 KB Output is correct
31 Correct 53 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 1 ms 208 KB Output is correct
38 Correct 3 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 3 ms 208 KB Output is correct
42 Correct 3 ms 208 KB Output is correct
43 Correct 3 ms 208 KB Output is correct
44 Correct 2 ms 208 KB Output is correct
45 Correct 31 ms 208 KB Output is correct
46 Correct 22 ms 208 KB Output is correct
47 Correct 81 ms 208 KB Output is correct
48 Correct 55 ms 208 KB Output is correct
49 Correct 59 ms 208 KB Output is correct
50 Correct 58 ms 208 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Correct 95 ms 208 KB Output is correct
53 Correct 84 ms 208 KB Output is correct
54 Correct 196 ms 208 KB Output is correct
55 Correct 173 ms 208 KB Output is correct
56 Correct 163 ms 208 KB Output is correct
57 Correct 173 ms 208 KB Output is correct
58 Correct 0 ms 208 KB Output is correct
59 Correct 0 ms 208 KB Output is correct
60 Correct 1 ms 208 KB Output is correct
61 Correct 1 ms 208 KB Output is correct
62 Correct 1 ms 208 KB Output is correct
63 Correct 2 ms 208 KB Output is correct
64 Correct 1 ms 208 KB Output is correct
65 Correct 1 ms 208 KB Output is correct
66 Correct 4 ms 208 KB Output is correct
67 Correct 4 ms 208 KB Output is correct
68 Correct 4 ms 208 KB Output is correct
69 Correct 3 ms 208 KB Output is correct
70 Correct 45 ms 208 KB Output is correct
71 Correct 27 ms 208 KB Output is correct
72 Correct 77 ms 208 KB Output is correct
73 Correct 61 ms 208 KB Output is correct
74 Correct 61 ms 208 KB Output is correct
75 Correct 59 ms 208 KB Output is correct
76 Correct 1 ms 208 KB Output is correct
77 Correct 109 ms 208 KB Output is correct
78 Correct 97 ms 208 KB Output is correct
79 Correct 142 ms 208 KB Output is correct
80 Correct 180 ms 208 KB Output is correct
81 Correct 169 ms 208 KB Output is correct
82 Correct 191 ms 208 KB Output is correct
83 Incorrect 757 ms 432 KB Not correct
84 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 208 KB Output is correct
10 Correct 3 ms 208 KB Output is correct
11 Correct 3 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 2 ms 208 KB Output is correct
20 Correct 2 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 6 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 4 ms 208 KB Output is correct
25 Correct 2 ms 208 KB Output is correct
26 Correct 38 ms 208 KB Output is correct
27 Correct 25 ms 208 KB Output is correct
28 Correct 46 ms 208 KB Output is correct
29 Correct 54 ms 208 KB Output is correct
30 Correct 57 ms 208 KB Output is correct
31 Correct 53 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 1 ms 208 KB Output is correct
38 Correct 3 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 3 ms 208 KB Output is correct
42 Correct 3 ms 208 KB Output is correct
43 Correct 3 ms 208 KB Output is correct
44 Correct 2 ms 208 KB Output is correct
45 Correct 31 ms 208 KB Output is correct
46 Correct 22 ms 208 KB Output is correct
47 Correct 81 ms 208 KB Output is correct
48 Correct 55 ms 208 KB Output is correct
49 Correct 59 ms 208 KB Output is correct
50 Correct 58 ms 208 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Correct 95 ms 208 KB Output is correct
53 Correct 84 ms 208 KB Output is correct
54 Correct 196 ms 208 KB Output is correct
55 Correct 173 ms 208 KB Output is correct
56 Correct 163 ms 208 KB Output is correct
57 Correct 173 ms 208 KB Output is correct
58 Correct 0 ms 208 KB Output is correct
59 Correct 0 ms 208 KB Output is correct
60 Correct 1 ms 208 KB Output is correct
61 Correct 1 ms 208 KB Output is correct
62 Correct 1 ms 208 KB Output is correct
63 Correct 2 ms 208 KB Output is correct
64 Correct 1 ms 208 KB Output is correct
65 Correct 1 ms 208 KB Output is correct
66 Correct 4 ms 208 KB Output is correct
67 Correct 4 ms 208 KB Output is correct
68 Correct 4 ms 208 KB Output is correct
69 Correct 3 ms 208 KB Output is correct
70 Correct 45 ms 208 KB Output is correct
71 Correct 27 ms 208 KB Output is correct
72 Correct 77 ms 208 KB Output is correct
73 Correct 61 ms 208 KB Output is correct
74 Correct 61 ms 208 KB Output is correct
75 Correct 59 ms 208 KB Output is correct
76 Correct 1 ms 208 KB Output is correct
77 Correct 109 ms 208 KB Output is correct
78 Correct 97 ms 208 KB Output is correct
79 Correct 142 ms 208 KB Output is correct
80 Correct 180 ms 208 KB Output is correct
81 Correct 169 ms 208 KB Output is correct
82 Correct 191 ms 208 KB Output is correct
83 Incorrect 757 ms 432 KB Not correct
84 Halted 0 ms 0 KB -