Submission #572869

#TimeUsernameProblemLanguageResultExecution timeMemory
572869ArvinAncient Machine (JOI21_ancient_machine)C++17
0 / 100
76 ms12264 KiB
#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) {
	for(int x=0;x<N;x++){
		if(S[x] == 'X'){
			Send(1);
			Send(0);
		} else if(S[x] == 'Y'){
			Send(0);
			Send(1);
		} else if(S[x] == 'Z'){
			Send(1);
			Send(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]);
//	}
	int S[N];
	for(int x=0;x<N;x++){
		S[x] = 0;
		for(int y=0;y<2;y++){
			if(A[2*x+y] == '1'){
				S[x] += (1 << y);
			}
		}
	}
	
	int table[N];
	int last[N][4];
	for(int x=0;x<N;x++){
		table[x] = (x > 0 ? table[x-1] : 0);
		for(int y=0;y<4;y++){
			last[x][y] = (x > 0 ? last[x-1][y] : -1);
		}
		last[x][S[x]] = x;
		
		if(S[x] == 3){
			int lst = last[x][2];
			int lst2 = last[lst][1];
			
			table[x] = max(table[x], table[lst2]+1);
		}
	}
	
	int mark[N];
	fill(mark, mark+N, 0);
	
	int cur = table[N-1];
	int pos = N-1;
	while(cur > 0){
		while(pos > 0 && table[pos-1] == cur){
			pos--;
		}
		
		int lst = last[pos][2];
		int lst2 = last[lst][1];
		mark[pos] = 3;
		mark[lst] = 2;
		mark[lst2] = 1;
	}
	
	for(int x=0;x<N;x++){
		if(mark[x] == 0){
			Remove(x);
		}
	}
	for(int x=0;x<N;x++){
		if(mark[x] == 2){
			Remove(x);
		}
	}
}

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...