Submission #1035001

# Submission time Handle Problem Language Result Execution time Memory
1035001 2024-07-26T02:34:20 Z pcc Abracadabra (CEOI22_abracadabra) C++17
0 / 100
3000 ms 11800 KB
#include <bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fs first
#define sc second

bool same(vector<int>&a,vector<int>&b){
	assert(a.size() == b.size());
	for(int i = 0;i<a.size();i++){
		if(a[i] != b[i])return false;
	}
	return true;
}

vector<int> shuf(vector<int> &v){
	vector<int> vl,vr;
	int pl = 0,pr = 0;
	for(int i = 0;i<v.size();i++){
		if(i+i<v.size())vl.push_back(v[i]);
		else vr.push_back(v[i]);
	}
	vector<int> re;
	while(pl<vl.size()&&pr<vr.size()){
		if(vl[pl]<vr[pr])re.push_back(vl[pl++]);
		else re.push_back(vr[pr++]);
	}
	while(pl<vl.size())re.push_back(vl[pl++]);
	while(pr<vr.size())re.push_back(vr[pr++]);
	return re;
}

int N,Q;
int epo;
vector<vector<int>> all;

void check_loop(vector<int> v){
	auto vv = v;
	cerr<<endl;
	while(!same(v,vv = shuf(v))){
		for(auto &i:v)cerr<<i<<' ';cerr<<'\n';
		epo++;
		vv.swap(v);
	}
	for(auto &i:v)cerr<<i<<' ';cerr<<'\n';
	cerr<<"EPO: "<<epo<<endl;
	return;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>Q;
	vector<int> v(N);
	for(int i = 0;i<N;i++)cin>>v[i];
	epo = 0;
	int t,id;
	Q--;cin>>t>>id;
	vector<int> vv;
	while(t--&&!same(v,vv = shuf(v))){
		v.swap(vv);
	}
	cout<<v[id-1]<<'\n';
	while(Q--){
		int t,id;
		cin>>t>>id;
		cout<<v[id-1]<<'\n';
	}
	return 0;
}

Compilation message

Main.cpp: In function 'bool same(std::vector<int>&, std::vector<int>&)':
Main.cpp:10:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for(int i = 0;i<a.size();i++){
      |                ~^~~~~~~~~
Main.cpp: In function 'std::vector<int> shuf(std::vector<int>&)':
Main.cpp:19:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i = 0;i<v.size();i++){
      |                ~^~~~~~~~~
Main.cpp:20:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   if(i+i<v.size())vl.push_back(v[i]);
      |      ~~~^~~~~~~~~
Main.cpp:24:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  while(pl<vl.size()&&pr<vr.size()){
      |        ~~^~~~~~~~~~
Main.cpp:24:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  while(pl<vl.size()&&pr<vr.size()){
      |                      ~~^~~~~~~~~~
Main.cpp:28:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  while(pl<vl.size())re.push_back(vl[pl++]);
      |        ~~^~~~~~~~~~
Main.cpp:29:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  while(pr<vr.size())re.push_back(vr[pr++]);
      |        ~~^~~~~~~~~~
Main.cpp: In function 'void check_loop(std::vector<int>)':
Main.cpp:41:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   41 |   for(auto &i:v)cerr<<i<<' ';cerr<<'\n';
      |   ^~~
Main.cpp:41:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   41 |   for(auto &i:v)cerr<<i<<' ';cerr<<'\n';
      |                              ^~~~
Main.cpp:45:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   45 |  for(auto &i:v)cerr<<i<<' ';cerr<<'\n';
      |  ^~~
Main.cpp:45:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   45 |  for(auto &i:v)cerr<<i<<' ';cerr<<'\n';
      |                             ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 127 ms 11800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3037 ms 7516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3023 ms 4248 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 127 ms 11800 KB Output isn't correct
2 Halted 0 ms 0 KB -