Submission #640049

# Submission time Handle Problem Language Result Execution time Memory
640049 2022-09-13T11:55:32 Z jasmin The Collection Game (BOI21_swaps) C++14
35 / 100
85 ms 520 KB
#include <swaps.h>
#include<cassert>
#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);
	}
 
	while(true){
 
		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);
}*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 5 ms 208 KB Correct
3 Correct 18 ms 332 KB Correct
4 Correct 66 ms 384 KB Correct
5 Correct 69 ms 444 KB Correct
6 Correct 66 ms 380 KB Correct
7 Correct 64 ms 356 KB Correct
8 Correct 85 ms 512 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 4 ms 208 KB Correct
3 Correct 26 ms 332 KB Correct
4 Correct 75 ms 352 KB Correct
5 Correct 72 ms 380 KB Correct
6 Correct 80 ms 352 KB Correct
7 Correct 78 ms 396 KB Correct
8 Correct 83 ms 396 KB Correct
9 Correct 75 ms 352 KB Correct
10 Correct 71 ms 388 KB Correct
11 Correct 69 ms 380 KB Correct
12 Correct 70 ms 356 KB Correct
13 Correct 66 ms 396 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 208 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 208 KB Correct
3 Correct 1 ms 208 KB Correct
4 Correct 5 ms 316 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 208 KB Correct
3 Correct 21 ms 328 KB Correct
4 Correct 72 ms 400 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 5 ms 208 KB Correct
3 Correct 21 ms 328 KB Correct
4 Correct 72 ms 400 KB Correct
5 Correct 1 ms 208 KB Correct
6 Correct 5 ms 308 KB Correct
7 Correct 24 ms 324 KB Correct
8 Correct 82 ms 424 KB Correct
9 Correct 75 ms 372 KB Correct
10 Correct 68 ms 396 KB Correct
11 Correct 76 ms 400 KB Correct
12 Correct 84 ms 400 KB Correct
13 Correct 1 ms 208 KB Correct
14 Correct 4 ms 208 KB Correct
15 Correct 21 ms 320 KB Correct
16 Correct 75 ms 352 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 6 ms 208 KB Correct
3 Correct 20 ms 324 KB Correct
4 Correct 70 ms 488 KB Correct
5 Runtime error 66 ms 516 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 208 KB Correct
3 Correct 20 ms 324 KB Correct
4 Correct 70 ms 488 KB Correct
5 Runtime error 66 ms 516 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 312 KB Correct
3 Correct 21 ms 308 KB Correct
4 Correct 80 ms 400 KB Correct
5 Runtime error 45 ms 516 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 312 KB Correct
3 Correct 21 ms 308 KB Correct
4 Correct 80 ms 400 KB Correct
5 Runtime error 45 ms 516 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 308 KB Correct
3 Correct 20 ms 336 KB Correct
4 Correct 70 ms 400 KB Correct
5 Runtime error 41 ms 520 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 308 KB Correct
3 Correct 20 ms 336 KB Correct
4 Correct 70 ms 400 KB Correct
5 Runtime error 41 ms 520 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -