Submission #877488

# Submission time Handle Problem Language Result Execution time Memory
877488 2023-11-23T09:22:02 Z vjudge1 Art Collections (BOI22_art) C++17
50 / 100
579 ms 64228 KB
#include "art.h"
#include <bits/stdc++.h>

using namespace std;

//#define int long long

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

using ll = long long;
using ld = long double;
 
const int mxn = 4005;


int c[mxn][mxn];
int n;

vector<int> vec;
int og;

bool comp(int a,int b){
    if(c[a][b] != -1)return c[a][b];
    
    swap(vec[a-1], vec[b-1]);
    int nw = publish(vec);
    swap(vec[a-1], vec[b-1]);

    return (a < b) ^ (nw < og);
}

void solve(int _n) {
    memset(c, -1, sizeof c);
    n = _n;



    vector<int> v;
    for(int i = 1;i<=n;i++){
        v.pb(i);
        vec.pb(i);
    }

    og = publish(vec);

    stable_sort(all(v), comp);
    answer(v);

}

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) {
      |        ~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 63064 KB Output is correct
2 Correct 8 ms 63180 KB Output is correct
3 Correct 8 ms 63064 KB Output is correct
4 Correct 8 ms 63064 KB Output is correct
5 Correct 8 ms 63064 KB Output is correct
6 Correct 8 ms 63064 KB Output is correct
7 Correct 8 ms 63064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 63064 KB Output is correct
2 Correct 8 ms 63180 KB Output is correct
3 Correct 8 ms 63064 KB Output is correct
4 Correct 8 ms 63064 KB Output is correct
5 Correct 8 ms 63064 KB Output is correct
6 Correct 8 ms 63064 KB Output is correct
7 Correct 8 ms 63064 KB Output is correct
8 Correct 8 ms 63064 KB Output is correct
9 Correct 9 ms 63148 KB Output is correct
10 Correct 9 ms 63064 KB Output is correct
11 Correct 9 ms 63064 KB Output is correct
12 Correct 9 ms 63064 KB Output is correct
13 Correct 8 ms 63064 KB Output is correct
14 Correct 7 ms 63064 KB Output is correct
15 Correct 8 ms 63064 KB Output is correct
16 Correct 8 ms 63064 KB Output is correct
17 Correct 8 ms 63064 KB Output is correct
18 Correct 8 ms 63128 KB Output is correct
19 Correct 8 ms 63064 KB Output is correct
20 Correct 8 ms 63064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 63064 KB Output is correct
2 Correct 8 ms 63180 KB Output is correct
3 Correct 8 ms 63064 KB Output is correct
4 Correct 8 ms 63064 KB Output is correct
5 Correct 8 ms 63064 KB Output is correct
6 Correct 8 ms 63064 KB Output is correct
7 Correct 8 ms 63064 KB Output is correct
8 Correct 8 ms 63064 KB Output is correct
9 Correct 9 ms 63148 KB Output is correct
10 Correct 9 ms 63064 KB Output is correct
11 Correct 9 ms 63064 KB Output is correct
12 Correct 9 ms 63064 KB Output is correct
13 Correct 8 ms 63064 KB Output is correct
14 Correct 7 ms 63064 KB Output is correct
15 Correct 8 ms 63064 KB Output is correct
16 Correct 8 ms 63064 KB Output is correct
17 Correct 8 ms 63064 KB Output is correct
18 Correct 8 ms 63128 KB Output is correct
19 Correct 8 ms 63064 KB Output is correct
20 Correct 8 ms 63064 KB Output is correct
21 Correct 8 ms 63064 KB Output is correct
22 Correct 9 ms 63064 KB Output is correct
23 Correct 9 ms 63060 KB Output is correct
24 Correct 9 ms 63316 KB Output is correct
25 Correct 9 ms 63064 KB Output is correct
26 Correct 34 ms 63216 KB Output is correct
27 Correct 27 ms 63216 KB Output is correct
28 Correct 51 ms 63216 KB Output is correct
29 Correct 49 ms 63216 KB Output is correct
30 Correct 52 ms 63224 KB Output is correct
31 Correct 49 ms 63212 KB Output is correct
32 Correct 8 ms 63064 KB Output is correct
33 Correct 8 ms 63064 KB Output is correct
34 Correct 8 ms 63316 KB Output is correct
35 Correct 8 ms 63064 KB Output is correct
36 Correct 8 ms 63064 KB Output is correct
37 Correct 8 ms 63096 KB Output is correct
38 Correct 9 ms 63064 KB Output is correct
39 Correct 8 ms 63064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 63064 KB Output is correct
2 Correct 8 ms 63180 KB Output is correct
3 Correct 8 ms 63064 KB Output is correct
4 Correct 8 ms 63064 KB Output is correct
5 Correct 8 ms 63064 KB Output is correct
6 Correct 8 ms 63064 KB Output is correct
7 Correct 8 ms 63064 KB Output is correct
8 Correct 8 ms 63064 KB Output is correct
9 Correct 9 ms 63148 KB Output is correct
10 Correct 9 ms 63064 KB Output is correct
11 Correct 9 ms 63064 KB Output is correct
12 Correct 9 ms 63064 KB Output is correct
13 Correct 8 ms 63064 KB Output is correct
14 Correct 7 ms 63064 KB Output is correct
15 Correct 8 ms 63064 KB Output is correct
16 Correct 8 ms 63064 KB Output is correct
17 Correct 8 ms 63064 KB Output is correct
18 Correct 8 ms 63128 KB Output is correct
19 Correct 8 ms 63064 KB Output is correct
20 Correct 8 ms 63064 KB Output is correct
21 Correct 8 ms 63064 KB Output is correct
22 Correct 9 ms 63064 KB Output is correct
23 Correct 9 ms 63060 KB Output is correct
24 Correct 9 ms 63316 KB Output is correct
25 Correct 9 ms 63064 KB Output is correct
26 Correct 34 ms 63216 KB Output is correct
27 Correct 27 ms 63216 KB Output is correct
28 Correct 51 ms 63216 KB Output is correct
29 Correct 49 ms 63216 KB Output is correct
30 Correct 52 ms 63224 KB Output is correct
31 Correct 49 ms 63212 KB Output is correct
32 Correct 8 ms 63064 KB Output is correct
33 Correct 8 ms 63064 KB Output is correct
34 Correct 8 ms 63316 KB Output is correct
35 Correct 8 ms 63064 KB Output is correct
36 Correct 8 ms 63064 KB Output is correct
37 Correct 8 ms 63096 KB Output is correct
38 Correct 9 ms 63064 KB Output is correct
39 Correct 8 ms 63064 KB Output is correct
40 Correct 8 ms 63064 KB Output is correct
41 Correct 9 ms 63140 KB Output is correct
42 Correct 9 ms 63064 KB Output is correct
43 Correct 10 ms 63064 KB Output is correct
44 Correct 10 ms 63064 KB Output is correct
45 Correct 36 ms 63220 KB Output is correct
46 Correct 26 ms 63216 KB Output is correct
47 Correct 49 ms 63224 KB Output is correct
48 Correct 52 ms 63220 KB Output is correct
49 Correct 49 ms 63216 KB Output is correct
50 Correct 50 ms 63220 KB Output is correct
51 Correct 8 ms 63064 KB Output is correct
52 Correct 83 ms 63220 KB Output is correct
53 Correct 68 ms 63220 KB Output is correct
54 Correct 136 ms 63224 KB Output is correct
55 Correct 135 ms 63220 KB Output is correct
56 Correct 138 ms 63224 KB Output is correct
57 Correct 135 ms 63224 KB Output is correct
58 Correct 8 ms 63064 KB Output is correct
59 Correct 8 ms 63112 KB Output is correct
60 Correct 8 ms 63064 KB Output is correct
61 Correct 8 ms 63064 KB Output is correct
62 Correct 8 ms 63064 KB Output is correct
63 Correct 8 ms 63064 KB Output is correct
64 Correct 9 ms 63108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 63064 KB Output is correct
2 Correct 8 ms 63180 KB Output is correct
3 Correct 8 ms 63064 KB Output is correct
4 Correct 8 ms 63064 KB Output is correct
5 Correct 8 ms 63064 KB Output is correct
6 Correct 8 ms 63064 KB Output is correct
7 Correct 8 ms 63064 KB Output is correct
8 Correct 8 ms 63064 KB Output is correct
9 Correct 9 ms 63148 KB Output is correct
10 Correct 9 ms 63064 KB Output is correct
11 Correct 9 ms 63064 KB Output is correct
12 Correct 9 ms 63064 KB Output is correct
13 Correct 8 ms 63064 KB Output is correct
14 Correct 7 ms 63064 KB Output is correct
15 Correct 8 ms 63064 KB Output is correct
16 Correct 8 ms 63064 KB Output is correct
17 Correct 8 ms 63064 KB Output is correct
18 Correct 8 ms 63128 KB Output is correct
19 Correct 8 ms 63064 KB Output is correct
20 Correct 8 ms 63064 KB Output is correct
21 Correct 8 ms 63064 KB Output is correct
22 Correct 9 ms 63064 KB Output is correct
23 Correct 9 ms 63060 KB Output is correct
24 Correct 9 ms 63316 KB Output is correct
25 Correct 9 ms 63064 KB Output is correct
26 Correct 34 ms 63216 KB Output is correct
27 Correct 27 ms 63216 KB Output is correct
28 Correct 51 ms 63216 KB Output is correct
29 Correct 49 ms 63216 KB Output is correct
30 Correct 52 ms 63224 KB Output is correct
31 Correct 49 ms 63212 KB Output is correct
32 Correct 8 ms 63064 KB Output is correct
33 Correct 8 ms 63064 KB Output is correct
34 Correct 8 ms 63316 KB Output is correct
35 Correct 8 ms 63064 KB Output is correct
36 Correct 8 ms 63064 KB Output is correct
37 Correct 8 ms 63096 KB Output is correct
38 Correct 9 ms 63064 KB Output is correct
39 Correct 8 ms 63064 KB Output is correct
40 Correct 8 ms 63064 KB Output is correct
41 Correct 9 ms 63140 KB Output is correct
42 Correct 9 ms 63064 KB Output is correct
43 Correct 10 ms 63064 KB Output is correct
44 Correct 10 ms 63064 KB Output is correct
45 Correct 36 ms 63220 KB Output is correct
46 Correct 26 ms 63216 KB Output is correct
47 Correct 49 ms 63224 KB Output is correct
48 Correct 52 ms 63220 KB Output is correct
49 Correct 49 ms 63216 KB Output is correct
50 Correct 50 ms 63220 KB Output is correct
51 Correct 8 ms 63064 KB Output is correct
52 Correct 83 ms 63220 KB Output is correct
53 Correct 68 ms 63220 KB Output is correct
54 Correct 136 ms 63224 KB Output is correct
55 Correct 135 ms 63220 KB Output is correct
56 Correct 138 ms 63224 KB Output is correct
57 Correct 135 ms 63224 KB Output is correct
58 Correct 8 ms 63064 KB Output is correct
59 Correct 8 ms 63112 KB Output is correct
60 Correct 8 ms 63064 KB Output is correct
61 Correct 8 ms 63064 KB Output is correct
62 Correct 8 ms 63064 KB Output is correct
63 Correct 8 ms 63064 KB Output is correct
64 Correct 9 ms 63108 KB Output is correct
65 Correct 8 ms 63064 KB Output is correct
66 Correct 9 ms 63064 KB Output is correct
67 Correct 9 ms 63152 KB Output is correct
68 Correct 9 ms 63064 KB Output is correct
69 Correct 9 ms 63316 KB Output is correct
70 Correct 35 ms 63220 KB Output is correct
71 Correct 29 ms 63220 KB Output is correct
72 Correct 48 ms 63216 KB Output is correct
73 Correct 56 ms 63220 KB Output is correct
74 Correct 55 ms 63220 KB Output is correct
75 Correct 50 ms 63216 KB Output is correct
76 Correct 8 ms 63064 KB Output is correct
77 Correct 82 ms 63220 KB Output is correct
78 Correct 77 ms 63220 KB Output is correct
79 Correct 149 ms 63228 KB Output is correct
80 Correct 141 ms 63220 KB Output is correct
81 Correct 156 ms 63224 KB Output is correct
82 Correct 140 ms 63228 KB Output is correct
83 Incorrect 579 ms 64228 KB Not correct
84 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 63064 KB Output is correct
2 Correct 8 ms 63180 KB Output is correct
3 Correct 8 ms 63064 KB Output is correct
4 Correct 8 ms 63064 KB Output is correct
5 Correct 8 ms 63064 KB Output is correct
6 Correct 8 ms 63064 KB Output is correct
7 Correct 8 ms 63064 KB Output is correct
8 Correct 8 ms 63064 KB Output is correct
9 Correct 9 ms 63148 KB Output is correct
10 Correct 9 ms 63064 KB Output is correct
11 Correct 9 ms 63064 KB Output is correct
12 Correct 9 ms 63064 KB Output is correct
13 Correct 8 ms 63064 KB Output is correct
14 Correct 7 ms 63064 KB Output is correct
15 Correct 8 ms 63064 KB Output is correct
16 Correct 8 ms 63064 KB Output is correct
17 Correct 8 ms 63064 KB Output is correct
18 Correct 8 ms 63128 KB Output is correct
19 Correct 8 ms 63064 KB Output is correct
20 Correct 8 ms 63064 KB Output is correct
21 Correct 8 ms 63064 KB Output is correct
22 Correct 9 ms 63064 KB Output is correct
23 Correct 9 ms 63060 KB Output is correct
24 Correct 9 ms 63316 KB Output is correct
25 Correct 9 ms 63064 KB Output is correct
26 Correct 34 ms 63216 KB Output is correct
27 Correct 27 ms 63216 KB Output is correct
28 Correct 51 ms 63216 KB Output is correct
29 Correct 49 ms 63216 KB Output is correct
30 Correct 52 ms 63224 KB Output is correct
31 Correct 49 ms 63212 KB Output is correct
32 Correct 8 ms 63064 KB Output is correct
33 Correct 8 ms 63064 KB Output is correct
34 Correct 8 ms 63316 KB Output is correct
35 Correct 8 ms 63064 KB Output is correct
36 Correct 8 ms 63064 KB Output is correct
37 Correct 8 ms 63096 KB Output is correct
38 Correct 9 ms 63064 KB Output is correct
39 Correct 8 ms 63064 KB Output is correct
40 Correct 8 ms 63064 KB Output is correct
41 Correct 9 ms 63140 KB Output is correct
42 Correct 9 ms 63064 KB Output is correct
43 Correct 10 ms 63064 KB Output is correct
44 Correct 10 ms 63064 KB Output is correct
45 Correct 36 ms 63220 KB Output is correct
46 Correct 26 ms 63216 KB Output is correct
47 Correct 49 ms 63224 KB Output is correct
48 Correct 52 ms 63220 KB Output is correct
49 Correct 49 ms 63216 KB Output is correct
50 Correct 50 ms 63220 KB Output is correct
51 Correct 8 ms 63064 KB Output is correct
52 Correct 83 ms 63220 KB Output is correct
53 Correct 68 ms 63220 KB Output is correct
54 Correct 136 ms 63224 KB Output is correct
55 Correct 135 ms 63220 KB Output is correct
56 Correct 138 ms 63224 KB Output is correct
57 Correct 135 ms 63224 KB Output is correct
58 Correct 8 ms 63064 KB Output is correct
59 Correct 8 ms 63112 KB Output is correct
60 Correct 8 ms 63064 KB Output is correct
61 Correct 8 ms 63064 KB Output is correct
62 Correct 8 ms 63064 KB Output is correct
63 Correct 8 ms 63064 KB Output is correct
64 Correct 9 ms 63108 KB Output is correct
65 Correct 8 ms 63064 KB Output is correct
66 Correct 9 ms 63064 KB Output is correct
67 Correct 9 ms 63152 KB Output is correct
68 Correct 9 ms 63064 KB Output is correct
69 Correct 9 ms 63316 KB Output is correct
70 Correct 35 ms 63220 KB Output is correct
71 Correct 29 ms 63220 KB Output is correct
72 Correct 48 ms 63216 KB Output is correct
73 Correct 56 ms 63220 KB Output is correct
74 Correct 55 ms 63220 KB Output is correct
75 Correct 50 ms 63216 KB Output is correct
76 Correct 8 ms 63064 KB Output is correct
77 Correct 82 ms 63220 KB Output is correct
78 Correct 77 ms 63220 KB Output is correct
79 Correct 149 ms 63228 KB Output is correct
80 Correct 141 ms 63220 KB Output is correct
81 Correct 156 ms 63224 KB Output is correct
82 Correct 140 ms 63228 KB Output is correct
83 Incorrect 579 ms 64228 KB Not correct
84 Halted 0 ms 0 KB -