답안 #703935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
703935 2023-03-01T03:48:22 Z Chal1shkan Art Collections (BOI22_art) C++17
35 / 100
180 ms 292 KB
# include <bits/stdc++.h>
# include "art.h"

# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define sz(x) ((int)(x).size())
# define deb(x) cerr << #x  << " = " << x << endl; 
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const ll maxn = 2e5 + 25;
const ll inf = 2e9 + 0;
const ll mod = 998244353;
const ll dx[] = {-1, 1, 0, 0};
const ll dy[] = {0, 0, -1, 1};
 
using namespace std;

int n;

bool cmp (int x, int y)
{
	vector <int> v;
	v.pb(x);
	v.pb(y);
	bool used[n + 3] = {0};
	used[x] = used[y] = 1;
	for (int i = 1; i <= n; ++i)
	{
		if (!used[i])
		{
			v.pb(i);
		}
	}
	int cnt1 = publish(v);
	swap(v[0], v[1]);
	int cnt2 = publish(v);
	if (cnt2 == cnt1 + 1)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

void solve (int N)
{
	n = N;
	vector <int> v;
	for (int i = 1; i <= n; ++i) v.pb(i);
	stable_sort(v.begin(), v.end(), cmp);
	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) {
      |        ~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 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 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 6 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 5 ms 208 KB Output is correct
12 Correct 4 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 1 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 3 ms 216 KB Output is correct
20 Correct 3 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 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 6 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 5 ms 208 KB Output is correct
12 Correct 4 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 1 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 3 ms 216 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 8 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 8 ms 208 KB Output is correct
25 Correct 6 ms 208 KB Output is correct
26 Correct 69 ms 208 KB Output is correct
27 Correct 47 ms 212 KB Output is correct
28 Correct 106 ms 208 KB Output is correct
29 Correct 106 ms 208 KB Output is correct
30 Correct 125 ms 208 KB Output is correct
31 Correct 109 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 4 ms 208 KB Output is correct
39 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 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 6 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 5 ms 208 KB Output is correct
12 Correct 4 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 1 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 3 ms 216 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 8 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 8 ms 208 KB Output is correct
25 Correct 6 ms 208 KB Output is correct
26 Correct 69 ms 208 KB Output is correct
27 Correct 47 ms 212 KB Output is correct
28 Correct 106 ms 208 KB Output is correct
29 Correct 106 ms 208 KB Output is correct
30 Correct 125 ms 208 KB Output is correct
31 Correct 109 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 4 ms 208 KB Output is correct
39 Correct 2 ms 208 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 4 ms 208 KB Output is correct
42 Correct 4 ms 208 KB Output is correct
43 Correct 5 ms 208 KB Output is correct
44 Correct 6 ms 208 KB Output is correct
45 Correct 76 ms 208 KB Output is correct
46 Correct 45 ms 208 KB Output is correct
47 Correct 94 ms 292 KB Output is correct
48 Correct 109 ms 208 KB Output is correct
49 Correct 106 ms 208 KB Output is correct
50 Correct 114 ms 208 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 180 ms 208 KB Not correct
53 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 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 6 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 5 ms 208 KB Output is correct
12 Correct 4 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 1 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 3 ms 216 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 8 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 8 ms 208 KB Output is correct
25 Correct 6 ms 208 KB Output is correct
26 Correct 69 ms 208 KB Output is correct
27 Correct 47 ms 212 KB Output is correct
28 Correct 106 ms 208 KB Output is correct
29 Correct 106 ms 208 KB Output is correct
30 Correct 125 ms 208 KB Output is correct
31 Correct 109 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 4 ms 208 KB Output is correct
39 Correct 2 ms 208 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 4 ms 208 KB Output is correct
42 Correct 4 ms 208 KB Output is correct
43 Correct 5 ms 208 KB Output is correct
44 Correct 6 ms 208 KB Output is correct
45 Correct 76 ms 208 KB Output is correct
46 Correct 45 ms 208 KB Output is correct
47 Correct 94 ms 292 KB Output is correct
48 Correct 109 ms 208 KB Output is correct
49 Correct 106 ms 208 KB Output is correct
50 Correct 114 ms 208 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 180 ms 208 KB Not correct
53 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 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 6 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 5 ms 208 KB Output is correct
12 Correct 4 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 1 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 3 ms 216 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 8 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 8 ms 208 KB Output is correct
25 Correct 6 ms 208 KB Output is correct
26 Correct 69 ms 208 KB Output is correct
27 Correct 47 ms 212 KB Output is correct
28 Correct 106 ms 208 KB Output is correct
29 Correct 106 ms 208 KB Output is correct
30 Correct 125 ms 208 KB Output is correct
31 Correct 109 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 4 ms 208 KB Output is correct
39 Correct 2 ms 208 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 4 ms 208 KB Output is correct
42 Correct 4 ms 208 KB Output is correct
43 Correct 5 ms 208 KB Output is correct
44 Correct 6 ms 208 KB Output is correct
45 Correct 76 ms 208 KB Output is correct
46 Correct 45 ms 208 KB Output is correct
47 Correct 94 ms 292 KB Output is correct
48 Correct 109 ms 208 KB Output is correct
49 Correct 106 ms 208 KB Output is correct
50 Correct 114 ms 208 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 180 ms 208 KB Not correct
53 Halted 0 ms 0 KB -