Submission #640038

# Submission time Handle Problem Language Result Execution time Memory
640038 2022-09-13T11:27:59 Z jasmin The Collection Game (BOI21_swaps) C++14
0 / 100
43 ms 328 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";
}
 
vector<int> visit(){
    cout << "visit\n";
    int n;
    cin >> n;
    vector<int> ans(n);
    for(int i=0; i<n; i++){
        cin >> ans[i];
    }
    return ans;
}
 
void answer(vector<int>& ans){
    cout << "answer: \n";
    for(auto e: ans){
        cout << e << " ";
    }
    cout << "\n";
}*/
 
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++){
 
		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]);
			}
		}
 
		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++;
			}
		}
		op=op2;
 
	}
  	
  	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 Runtime error 36 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 43 ms 280 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 40 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 39 ms 276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 39 ms 276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 37 ms 280 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 37 ms 280 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 25 ms 288 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 25 ms 288 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -