Submission #496207

# Submission time Handle Problem Language Result Execution time Memory
496207 2021-12-21T03:08:16 Z minhcool Ancient Machine (JOI21_ancient_machine) C++17
Compilation error
0 ms 0 KB
#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;

//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

//const int oo = 1e18 + 7, mod = 1e9 + 7;

int ret[100005];

void Anna(int n, vector<char> S){
	int need = 0, occ = 0;
	for(int i = n - 1; i >= 0; i--){
		if(S[i] == 'Z'){
			occ = 1;
			ret[i] = 1;
		}
		else if(S[i] == 'X' && zed && (!i || S[i - 1] != 'X')){
			ret[i] = 1;
		}
	}
	for(int i = 0; i < n; i++) Send(ret[i]);
}
/*
void process(){

}

signed main(){
	ios_base::sync_with_stdio(0);
	process();
}*/
#include<bits/stdc++.h>
#include "Bruno.h"
using namespace std;

//#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;

//const int N = 1e5 + 5;

//const int oo = 1e18 + 7, mod = 1e9 + 7;

void Bruno(int N, int L, vector<int> a){
	//cout << N << " " << L << "\n";
	vector<int> not_rev;
	int pos = -1;
	for(int i = n - 1; i >= 0; i--){
		if(a[i]){
			pos = i;
			break;
		}
	}
	if(pos == -1){
		for(int i = 0; i < n; i++) Remove(i);
		return;
	}
	int lst = i;
	for(int i = pos - 1; i >= 0; i--){
		if(a[i]){
			for(int j = i + 1; j < lst; j++) Remove(j);
			Remove(i);
			lst = i;
		}
		//Remove(i);
	}
	for(int i = pos; i < n; i++) Remove(i);
}

/*
void process(){

}

signed main(){
	ios_base::sync_with_stdio(0);
	process();
}*/

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:28:26: error: 'zed' was not declared in this scope
   28 |   else if(S[i] == 'X' && zed && (!i || S[i - 1] != 'X')){
      |                          ^~~
Anna.cpp:22:6: warning: unused variable 'need' [-Wunused-variable]
   22 |  int need = 0, occ = 0;
      |      ^~~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:25:14: error: 'n' was not declared in this scope
   25 |  for(int i = n - 1; i >= 0; i--){
      |              ^
Bruno.cpp:32:22: error: 'n' was not declared in this scope
   32 |   for(int i = 0; i < n; i++) Remove(i);
      |                      ^
Bruno.cpp:35:12: error: 'i' was not declared in this scope
   35 |  int lst = i;
      |            ^
Bruno.cpp:44:23: error: 'n' was not declared in this scope
   44 |  for(int i = pos; i < n; i++) Remove(i);
      |                       ^