Submission #388206

# Submission time Handle Problem Language Result Execution time Memory
388206 2021-04-10T14:10:30 Z AmineWeslati Ancient Machine (JOI21_ancient_machine) C++17
Compilation error
0 ms 0 KB
//Never stop trying
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef long long ll;
typedef string str;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
//constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
ll random(ll a, ll b){
    return a + rng() % (b - a + 1);
}
#ifndef LOCAL  
#define cerr if(false) cerr
#endif
#define dbg(x) cerr << #x << " : " << x << endl; 
#define dbgs(x,y) cerr << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << #v << " : " << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;
#define here() cerr << "here" << endl;

void IO() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);
#endif
}
/////////////////////////ONLY CLEAN CODES ALLOWED/////////////////////////

#define Send send
#ifndef LOCAL
#include "Anna.h"
#endif
#ifdef LOCAL
void Send(int a){
	return; 
}
#endif

void Anna(int N, V<char> S) {
	FOR(i,0,N){
		if(S[i]=='X') send(0),send(0); 
		else if(S[i]=='Y') send(0),send(1);
		else send(1),send(0);
	}
}

#ifdef LOCAL
int main() {
    boost; IO();
    

    return 0;
}
#endif
//Change your approach 
//Never stop trying
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

typedef long long ll;
typedef string str;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define endl "\n"
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)

const int MOD = 1e9 + 7; //998244353
const ll INF = 1e18;
const int MX = 2e5 + 10;
const int nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0}; //right left down up

template<class T> using V = vector<T>;
template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
//constexpr int log2(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
ll random(ll a, ll b){
    return a + rng() % (b - a + 1);
}
#ifndef LOCAL  
#define cerr if(false) cerr
#endif
#define dbg(x) cerr << #x << " : " << x << endl; 
#define dbgs(x,y) cerr << #x << " : " << x << " / " << #y << " : " << y << endl;
#define dbgv(v) cerr << #v << " : " << "[ "; for(auto it : v) cerr << it << ' '; cerr << ']' << endl;
#define here() cerr << "here" << endl;

void IO() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);
#endif
}
/////////////////////////ONLY CLEAN CODES ALLOWED/////////////////////////

#define Remove rmv
#ifndef LOCAL
#include "Bruno.h"
#endif

#ifdef LOCAL
set<int>s;
vi a(MX);
int ans=0;
void Remove(int idx){
	auto i=s.find(idx);

	int y=(a[*i]==1);
	if(i!=s.begin()){
		i--;
		if(a[*i]!=0) y=0;
		i++; 

		i++;
		if(i==s.end()) y=0;
		else if(a[*i]!=2) y=0;
		i--;
	}
	else y=0;

	ans+=y;
	s.erase(i);
}
#endif

void Bruno(int N, int L, vi A) {
	vi vec;
	for(int i=0; i<L; i+=2){
		vec.pb(A[i]*2+A[i+1]);
	}

	vi st; 
	FOR(i,0,N){
		if(vec[i]==0){
			st.pb(i);
		}
		else if(vec[i]==2){
			rmv(i);
		}
		else{
			if(!sz(st)) 
				rmv(i);
			else{
				int j=i+1; 
				while(j<N && vec[j]!=2){
					rmv(j);
					j++;
				}
				rmv(i);
				i=j-1; 
			}
		}
	}
	while(sz(st)){
		rmv(st.back());
		st.pop_back();
	}
}



#ifdef LOCAL
int main() {
    boost; IO();

    int N; cin>>N;
    FOR(i,0,N) s.insert(i);
    vi vec;
    FOR(i,0,N){
    	int x; cin>>x; 
    	int y; cin>>y; 
    	vec.pb(x);
    	vec.pb(y);
    	a[i]=x*2+y;
    }
    Bruno(N,sz(vec),vec);
    cout << ans << endl;
    

    return 0;
}
#endif
//Change your approach 

Compilation message

/usr/bin/ld: /tmp/ccnbzqtW.o: in function `Anna(int, std::vector<char, std::allocator<char> >)':
Anna.cpp:(.text+0x56): undefined reference to `send(int)'
/usr/bin/ld: Anna.cpp:(.text+0x5d): undefined reference to `send(int)'
/usr/bin/ld: Anna.cpp:(.text+0x81): undefined reference to `send(int)'
/usr/bin/ld: Anna.cpp:(.text+0x8b): undefined reference to `send(int)'
/usr/bin/ld: Anna.cpp:(.text+0xa3): undefined reference to `send(int)'
/usr/bin/ld: /tmp/ccnbzqtW.o:Anna.cpp:(.text+0xaa): more undefined references to `send(int)' follow
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/cc76YGgG.o: in function `Bruno(int, int, std::vector<int, std::allocator<int> >)':
Bruno.cpp:(.text+0x1e9): undefined reference to `rmv(int)'
/usr/bin/ld: Bruno.cpp:(.text+0x267): undefined reference to `rmv(int)'
/usr/bin/ld: Bruno.cpp:(.text+0x2f6): undefined reference to `rmv(int)'
/usr/bin/ld: Bruno.cpp:(.text+0x319): undefined reference to `rmv(int)'
collect2: error: ld returned 1 exit status