Submission #419750

# Submission time Handle Problem Language Result Execution time Memory
419750 2021-06-07T12:14:49 Z amoo_safar Ancient Machine (JOI21_ancient_machine) C++17
69 / 100
83 ms 9172 KB
#include "Anna.h"
#include <bits/stdc++.h>

#define pb push_back

using namespace std;

void Anna(int _n, vector<char> S){
	vector<int> V(_n, 0), seq;
	int fl = 0, fly = 1;
	for(int i = _n - 1; i >= 0; i--){
		if(S[i] == 'Y') fly = 1;
		if(S[i] == 'Z')
			V[i] = 1, fly = 0;
	}
	int i = 0;
	for(auto c : S){
		if(fl == 0 && c == 'X'){
			fl = 1;
			seq.pb(1);
			seq.pb(0);
		} else {
			seq.pb(fl ? V[i] : 0);
		}
		i ++;
	}
	for(auto x : seq)
		Send(x);
	// for(auto x : seq)
		// cerr << x;
	// cerr << '\n';
	
}
#include "Bruno.h"
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

void Bruno(int _n, int L, vector<int> B) {
	int fl = 0;
	vector<int> A;
	for(int i = 0; i < L; i++){
		if(B[i] == 0) A.pb(0);
		else {
			A.pb(1);
			if(!fl) i++;
			fl = 1;
		}
	}
	A.resize(_n, 0);
	L = _n;

	int cnt = 0;
	vector<int> mk(_n, 0);
	for (int i = 0; i < L; i++) {
		// cerr << "!" << A[i] << '\n';
		if(A[i] == 1){
			cnt ++;
			for(int j = i - 1; j >= 0; j--){
				if(A[j] == 1) break;
				Remove(j);
				mk[j] = 1;
			}
			if(cnt != 1){
				Remove(i);
				mk[i] = 1;
			};
		}
	}
	for(int i = 0; i < _n; i++) if(!mk[i]) Remove(i);
}

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:10:14: warning: variable 'fly' set but not used [-Wunused-but-set-variable]
   10 |  int fl = 0, fly = 1;
      |              ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 0 ms 488 KB Output is correct
3 Correct 1 ms 480 KB Output is correct
4 Correct 0 ms 484 KB Output is correct
5 Correct 0 ms 492 KB Output is correct
6 Correct 0 ms 484 KB Output is correct
7 Correct 1 ms 492 KB Output is correct
8 Correct 1 ms 484 KB Output is correct
9 Correct 1 ms 484 KB Output is correct
10 Correct 0 ms 492 KB Output is correct
11 Correct 0 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 66 ms 9108 KB Partially correct
2 Partially correct 71 ms 9064 KB Partially correct
3 Partially correct 71 ms 9104 KB Partially correct
4 Partially correct 76 ms 9052 KB Partially correct
5 Partially correct 75 ms 9132 KB Partially correct
6 Partially correct 64 ms 9056 KB Partially correct
7 Partially correct 71 ms 9036 KB Partially correct
8 Partially correct 69 ms 9040 KB Partially correct
9 Partially correct 67 ms 9152 KB Partially correct
10 Partially correct 69 ms 9056 KB Partially correct
11 Partially correct 71 ms 9096 KB Partially correct
12 Partially correct 66 ms 9112 KB Partially correct
13 Partially correct 71 ms 9044 KB Partially correct
14 Partially correct 81 ms 9172 KB Partially correct
15 Partially correct 82 ms 9076 KB Partially correct
16 Partially correct 76 ms 9040 KB Partially correct
17 Partially correct 81 ms 9152 KB Partially correct
18 Partially correct 73 ms 9092 KB Partially correct
19 Partially correct 83 ms 9020 KB Partially correct
20 Partially correct 66 ms 9092 KB Partially correct
21 Partially correct 74 ms 9072 KB Partially correct
22 Partially correct 72 ms 9060 KB Partially correct
23 Partially correct 67 ms 9108 KB Partially correct
24 Partially correct 63 ms 9052 KB Partially correct
25 Partially correct 72 ms 9056 KB Partially correct
26 Partially correct 71 ms 9056 KB Partially correct
27 Partially correct 72 ms 9088 KB Partially correct
28 Partially correct 79 ms 9024 KB Partially correct
29 Partially correct 71 ms 9052 KB Partially correct
30 Partially correct 75 ms 9092 KB Partially correct
31 Partially correct 77 ms 8996 KB Partially correct
32 Partially correct 67 ms 9120 KB Partially correct
33 Partially correct 73 ms 9052 KB Partially correct