Submission #640041

# Submission time Handle Problem Language Result Execution time Memory
640041 2022-09-13T11:44:21 Z jasmin The Collection Game (BOI21_swaps) C++14
35 / 100
96 ms 628 KB
#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;
 		op2.assign(n, vector<int> (0));
	}
  	
  	vector<int> ans(n);
  	for(int i=0; i<n; i++){
      ans[i]=op[i][0];
    }
  	answer(ans);
}
 
/*signed main(){
	int n, v;
	cin >> n >> v;
	solve(n, v);
}*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 312 KB Correct
3 Correct 22 ms 324 KB Correct
4 Correct 76 ms 396 KB Correct
5 Correct 81 ms 352 KB Correct
6 Correct 79 ms 488 KB Correct
7 Correct 76 ms 396 KB Correct
8 Correct 73 ms 360 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 5 ms 308 KB Correct
3 Correct 22 ms 324 KB Correct
4 Correct 75 ms 352 KB Correct
5 Correct 81 ms 356 KB Correct
6 Correct 70 ms 384 KB Correct
7 Correct 86 ms 476 KB Correct
8 Correct 72 ms 484 KB Correct
9 Correct 85 ms 456 KB Correct
10 Correct 83 ms 520 KB Correct
11 Correct 71 ms 388 KB Correct
12 Correct 96 ms 356 KB Correct
13 Correct 71 ms 356 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 7 ms 308 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 7 ms 308 KB Correct
3 Correct 1 ms 208 KB Correct
4 Correct 5 ms 308 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 20 ms 316 KB Correct
4 Correct 65 ms 400 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 20 ms 316 KB Correct
4 Correct 65 ms 400 KB Correct
5 Correct 1 ms 208 KB Correct
6 Correct 4 ms 208 KB Correct
7 Correct 20 ms 328 KB Correct
8 Correct 84 ms 464 KB Correct
9 Correct 68 ms 404 KB Correct
10 Correct 67 ms 352 KB Correct
11 Correct 71 ms 360 KB Correct
12 Correct 69 ms 388 KB Correct
13 Correct 1 ms 208 KB Correct
14 Correct 5 ms 208 KB Correct
15 Correct 22 ms 336 KB Correct
16 Correct 73 ms 440 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 300 KB Correct
3 Correct 27 ms 320 KB Correct
4 Correct 69 ms 400 KB Correct
5 Runtime error 41 ms 628 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 300 KB Correct
3 Correct 27 ms 320 KB Correct
4 Correct 69 ms 400 KB Correct
5 Runtime error 41 ms 628 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 300 KB Correct
3 Correct 19 ms 336 KB Correct
4 Correct 72 ms 388 KB Correct
5 Runtime error 53 ms 512 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 4 ms 300 KB Correct
3 Correct 19 ms 336 KB Correct
4 Correct 72 ms 388 KB Correct
5 Runtime error 53 ms 512 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 6 ms 308 KB Correct
3 Correct 21 ms 324 KB Correct
4 Correct 71 ms 388 KB Correct
5 Runtime error 41 ms 588 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 6 ms 308 KB Correct
3 Correct 21 ms 324 KB Correct
4 Correct 71 ms 388 KB Correct
5 Runtime error 41 ms 588 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -