Submission #574504

# Submission time Handle Problem Language Result Execution time Memory
574504 2022-06-08T15:59:37 Z Arvin Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
38 ms 5216 KB
#include "Anna.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long

namespace {

int variable_example = 0;

}

void Anna(int N, std::vector<char> S) {
	vector<int> ans;
	vector<pair<int, int>> v;
	int pos = -1;
	for(int x=0;x<N;x++){
		if(S[x] == 'Z'){
			while(!v.empty()){
				if(pos != -1){
					Send(1);
					ans.push_back(pos);
				}
				
				Send(1);
				ans.push_back(v.back().second);
				pos = v.back().first;
				
				v.pop_back();
			}
			Send(1);
			ans.push_back(x);
		} else if(S[x] == 'Y'){
			if(pos != -1){
				Send(0);
				v.push_back({pos, x});
				pos = -1;
			} else {
				Send(1);
				ans.push_back(x);
			}
		} else if(S[x] == 'X'){
			if(pos != -1){
				Send(1);
				ans.push_back(x);
			} else {
				Send(0);
				pos = x;
			}
		}
	}
	
	while(!v.empty()){
		Send(1); Send(1);
		ans.push_back(v.back().first);
		ans.push_back(v.back().second);
		v.pop_back();
	}
	if(pos != -1){
		Send(1);
		ans.push_back(pos);
		pos = -1;
	}
}
#include "Bruno.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long

namespace {

int variable_example = 0;

int FunctionExample(int P) { return 1 - P; }

}  // namespace

void Bruno(int N, int L, std::vector<int> A) {
//	for (int i = 0; i < L; i++) {
//	variable_example += FunctionExample(A[i]);
//	}
	vector<int> ans;
	vector<int> v;
	int lst = 0;
	for(int x=0;x<N;x++){
		if(A[x] == 0){
			v.push_back(x);
			lst = x+1;
		} else if(A[x] == 1){
			if(x+1 < N && A[x+1] == 1) continue;
			int cnt = x-lst+1;
			cnt--;
			
			while(cnt > 0){
				ans.push_back(v.back());
				v.pop_back();
			}
			
			ans.push_back(x);
			lst = x+1;
		}
	}
	
	for(auto val : ans){
//		cout << "- " << val << "\n";
		Remove(val);
	}
}

Compilation message

Anna.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   10 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~

Bruno.cpp:12:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
   12 | int FunctionExample(int P) { return 1 - P; }
      |     ^~~~~~~~~~~~~~~
Bruno.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   10 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1156 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 5216 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -