답안 #572973

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
572973 2022-06-05T15:12:16 Z StrawHatWess Art Collections (BOI22_art) C++17
20 / 100
106 ms 3152 KB
#include "art.h"

#include <bits/stdc++.h>
using namespace std;

typedef vector<int>vi; 
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
#define FOR(i,a,b) for(int i=a; i<b; i++)


//------------------------------

const int MX=1e5; 

vi adj[MX],vis(MX,0),vec; 

void dfs(int u){
	vis[u]=1; 
	for(int v: adj[u]) if(!vis[v]) dfs(v); 
	vec.pb(u); 
}

void solve(int N) {
	FOR(i,1,N+1) FOR(j,i+1,N+1){
		vi vec={i,j}; 
		FOR(k,1,N+1) if(k!=i && k!=j) vec.pb(k); 

		int x=publish(vec); 
		swap(vec[0],vec[1]); 
		int y=publish(vec); 


		if(y>x) adj[i].pb(j); 
		else adj[j].pb(i);
	}

	FOR(i,1,N+1) if(!vis[i]) dfs(i); 
	reverse(all(vec)); 

	answer(vec); 
}

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 2 ms 3024 KB Output is correct
2 Correct 2 ms 3024 KB Output is correct
3 Correct 2 ms 3024 KB Output is correct
4 Correct 2 ms 3024 KB Output is correct
5 Correct 2 ms 3024 KB Output is correct
6 Correct 2 ms 3024 KB Output is correct
7 Correct 2 ms 3024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3024 KB Output is correct
2 Correct 2 ms 3024 KB Output is correct
3 Correct 2 ms 3024 KB Output is correct
4 Correct 2 ms 3024 KB Output is correct
5 Correct 2 ms 3024 KB Output is correct
6 Correct 2 ms 3024 KB Output is correct
7 Correct 2 ms 3024 KB Output is correct
8 Correct 3 ms 3044 KB Output is correct
9 Correct 20 ms 3060 KB Output is correct
10 Correct 17 ms 3052 KB Output is correct
11 Correct 18 ms 3052 KB Output is correct
12 Correct 23 ms 3052 KB Output is correct
13 Correct 2 ms 3024 KB Output is correct
14 Correct 2 ms 3024 KB Output is correct
15 Correct 2 ms 3024 KB Output is correct
16 Correct 2 ms 3024 KB Output is correct
17 Correct 2 ms 3024 KB Output is correct
18 Correct 2 ms 3024 KB Output is correct
19 Correct 21 ms 3152 KB Output is correct
20 Correct 25 ms 3056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3024 KB Output is correct
2 Correct 2 ms 3024 KB Output is correct
3 Correct 2 ms 3024 KB Output is correct
4 Correct 2 ms 3024 KB Output is correct
5 Correct 2 ms 3024 KB Output is correct
6 Correct 2 ms 3024 KB Output is correct
7 Correct 2 ms 3024 KB Output is correct
8 Correct 3 ms 3044 KB Output is correct
9 Correct 20 ms 3060 KB Output is correct
10 Correct 17 ms 3052 KB Output is correct
11 Correct 18 ms 3052 KB Output is correct
12 Correct 23 ms 3052 KB Output is correct
13 Correct 2 ms 3024 KB Output is correct
14 Correct 2 ms 3024 KB Output is correct
15 Correct 2 ms 3024 KB Output is correct
16 Correct 2 ms 3024 KB Output is correct
17 Correct 2 ms 3024 KB Output is correct
18 Correct 2 ms 3024 KB Output is correct
19 Correct 21 ms 3152 KB Output is correct
20 Correct 25 ms 3056 KB Output is correct
21 Correct 2 ms 3024 KB Output is correct
22 Correct 17 ms 3024 KB Output is correct
23 Correct 18 ms 3024 KB Output is correct
24 Correct 20 ms 3056 KB Output is correct
25 Correct 21 ms 3064 KB Output is correct
26 Incorrect 106 ms 3044 KB Not correct
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3024 KB Output is correct
2 Correct 2 ms 3024 KB Output is correct
3 Correct 2 ms 3024 KB Output is correct
4 Correct 2 ms 3024 KB Output is correct
5 Correct 2 ms 3024 KB Output is correct
6 Correct 2 ms 3024 KB Output is correct
7 Correct 2 ms 3024 KB Output is correct
8 Correct 3 ms 3044 KB Output is correct
9 Correct 20 ms 3060 KB Output is correct
10 Correct 17 ms 3052 KB Output is correct
11 Correct 18 ms 3052 KB Output is correct
12 Correct 23 ms 3052 KB Output is correct
13 Correct 2 ms 3024 KB Output is correct
14 Correct 2 ms 3024 KB Output is correct
15 Correct 2 ms 3024 KB Output is correct
16 Correct 2 ms 3024 KB Output is correct
17 Correct 2 ms 3024 KB Output is correct
18 Correct 2 ms 3024 KB Output is correct
19 Correct 21 ms 3152 KB Output is correct
20 Correct 25 ms 3056 KB Output is correct
21 Correct 2 ms 3024 KB Output is correct
22 Correct 17 ms 3024 KB Output is correct
23 Correct 18 ms 3024 KB Output is correct
24 Correct 20 ms 3056 KB Output is correct
25 Correct 21 ms 3064 KB Output is correct
26 Incorrect 106 ms 3044 KB Not correct
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3024 KB Output is correct
2 Correct 2 ms 3024 KB Output is correct
3 Correct 2 ms 3024 KB Output is correct
4 Correct 2 ms 3024 KB Output is correct
5 Correct 2 ms 3024 KB Output is correct
6 Correct 2 ms 3024 KB Output is correct
7 Correct 2 ms 3024 KB Output is correct
8 Correct 3 ms 3044 KB Output is correct
9 Correct 20 ms 3060 KB Output is correct
10 Correct 17 ms 3052 KB Output is correct
11 Correct 18 ms 3052 KB Output is correct
12 Correct 23 ms 3052 KB Output is correct
13 Correct 2 ms 3024 KB Output is correct
14 Correct 2 ms 3024 KB Output is correct
15 Correct 2 ms 3024 KB Output is correct
16 Correct 2 ms 3024 KB Output is correct
17 Correct 2 ms 3024 KB Output is correct
18 Correct 2 ms 3024 KB Output is correct
19 Correct 21 ms 3152 KB Output is correct
20 Correct 25 ms 3056 KB Output is correct
21 Correct 2 ms 3024 KB Output is correct
22 Correct 17 ms 3024 KB Output is correct
23 Correct 18 ms 3024 KB Output is correct
24 Correct 20 ms 3056 KB Output is correct
25 Correct 21 ms 3064 KB Output is correct
26 Incorrect 106 ms 3044 KB Not correct
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3024 KB Output is correct
2 Correct 2 ms 3024 KB Output is correct
3 Correct 2 ms 3024 KB Output is correct
4 Correct 2 ms 3024 KB Output is correct
5 Correct 2 ms 3024 KB Output is correct
6 Correct 2 ms 3024 KB Output is correct
7 Correct 2 ms 3024 KB Output is correct
8 Correct 3 ms 3044 KB Output is correct
9 Correct 20 ms 3060 KB Output is correct
10 Correct 17 ms 3052 KB Output is correct
11 Correct 18 ms 3052 KB Output is correct
12 Correct 23 ms 3052 KB Output is correct
13 Correct 2 ms 3024 KB Output is correct
14 Correct 2 ms 3024 KB Output is correct
15 Correct 2 ms 3024 KB Output is correct
16 Correct 2 ms 3024 KB Output is correct
17 Correct 2 ms 3024 KB Output is correct
18 Correct 2 ms 3024 KB Output is correct
19 Correct 21 ms 3152 KB Output is correct
20 Correct 25 ms 3056 KB Output is correct
21 Correct 2 ms 3024 KB Output is correct
22 Correct 17 ms 3024 KB Output is correct
23 Correct 18 ms 3024 KB Output is correct
24 Correct 20 ms 3056 KB Output is correct
25 Correct 21 ms 3064 KB Output is correct
26 Incorrect 106 ms 3044 KB Not correct
27 Halted 0 ms 0 KB -