답안 #640046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
640046 2022-09-13T11:51:56 Z jasmin The Collection Game (BOI21_swaps) C++14
35 / 100
91 ms 788 KB
#include <cassert>
#include <swaps.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
using namespace std;
 
/*void schedule(int i, int j){
    cout << "schedule " << i << " " << j << "\n" << flush;
}
 
vector<int> visit(){
    cout << "visit\n" << flush;
    int n;
    cin >> n;
    vector<int> ans(n);
    for(int i=0; i<n; i++){
        cin >> ans[i];
    }
    cout << "Yes: " << n << "\n";
    return ans;
}
 
void answer(vector<int>& ans){
    cout << "answer: \n";
    for(auto e: ans){
        cout << e << " ";
    }
    cout << "\n" << flush;
}*/
 
void solve(int n, int v){
	vector<vector<int> > op(n);
	for(int i=0; i<n; i++){
		op[0].push_back(i+1);
	}
 
	for(int i=0; i<v; i++){
 
		int cnt=0;
		for(int j=0; j<n; j++){
			for(int k=0; k+1<(int)op[j].size(); k+=2){
				schedule(op[j][k], op[j][k+1]);
				cnt++;
			}
		}
		
		if(cnt==0) break;
 
		vector<int> resp=visit();
		int ind=0;
		vector<vector<int> > op2(n);
		for(int j=0; j<n; j++){
			for(int k=0; k+1<(int)op[j].size(); k+=2){
				if(resp[ind]){
					op2[j].push_back(op[j][k]);
					op2[j+1].push_back(op[j][k+1]);
				}
				else{
					op2[j+1].push_back(op[j][k]);
					op2[j].push_back(op[j][k+1]);
				}
				ind++;
			}
			if(op[j].size()%2==1){
				op2[j].push_back(op[j][op[j].size()-1]);
			}
		}
		op=op2;
	}
  	
  	vector<int> ans(n);
  	for(int i=0; i<n; i++){
  		assert(op[i].size()==1);
    	ans[i]=op[i][0];
    }
  	answer(ans);
}
 
/*signed main(){
	int n, v;
	cin >> n >> v;
	solve(n, v);
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 4 ms 304 KB Correct
3 Correct 25 ms 316 KB Correct
4 Correct 60 ms 468 KB Correct
5 Correct 69 ms 396 KB Correct
6 Correct 66 ms 416 KB Correct
7 Correct 68 ms 476 KB Correct
8 Correct 63 ms 380 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 6 ms 208 KB Correct
3 Correct 17 ms 328 KB Correct
4 Correct 69 ms 352 KB Correct
5 Correct 72 ms 388 KB Correct
6 Correct 71 ms 472 KB Correct
7 Correct 91 ms 396 KB Correct
8 Correct 70 ms 396 KB Correct
9 Correct 77 ms 404 KB Correct
10 Correct 71 ms 376 KB Correct
11 Correct 69 ms 356 KB Correct
12 Correct 71 ms 428 KB Correct
13 Correct 76 ms 360 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 5 ms 316 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 5 ms 316 KB Correct
3 Correct 0 ms 208 KB Correct
4 Correct 5 ms 208 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 19 ms 328 KB Correct
4 Correct 80 ms 400 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 19 ms 328 KB Correct
4 Correct 80 ms 400 KB Correct
5 Correct 1 ms 208 KB Correct
6 Correct 7 ms 300 KB Correct
7 Correct 21 ms 440 KB Correct
8 Correct 78 ms 380 KB Correct
9 Correct 69 ms 404 KB Correct
10 Correct 89 ms 388 KB Correct
11 Correct 70 ms 464 KB Correct
12 Correct 81 ms 396 KB Correct
13 Correct 0 ms 208 KB Correct
14 Correct 6 ms 208 KB Correct
15 Correct 23 ms 324 KB Correct
16 Correct 87 ms 356 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 6 ms 324 KB Correct
3 Correct 19 ms 336 KB Correct
4 Correct 67 ms 372 KB Correct
5 Runtime error 48 ms 624 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 6 ms 324 KB Correct
3 Correct 19 ms 336 KB Correct
4 Correct 67 ms 372 KB Correct
5 Runtime error 48 ms 624 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 6 ms 208 KB Correct
3 Correct 25 ms 320 KB Correct
4 Correct 70 ms 368 KB Correct
5 Runtime error 39 ms 700 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 6 ms 208 KB Correct
3 Correct 25 ms 320 KB Correct
4 Correct 70 ms 368 KB Correct
5 Runtime error 39 ms 700 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 4 ms 312 KB Correct
3 Correct 28 ms 316 KB Correct
4 Correct 73 ms 500 KB Correct
5 Runtime error 49 ms 788 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 4 ms 312 KB Correct
3 Correct 28 ms 316 KB Correct
4 Correct 73 ms 500 KB Correct
5 Runtime error 49 ms 788 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -