#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
// #define int long long
#define ll long long
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) [&](decltype(x) _x) {cerr << #x << " = " << _x << endl; return _x;}(x)
using pii = pair<int, int>;
const ll inf = 1ll << 60;
template <typename T, typename U>
ostream& operator<<(ostream& out, pair<T, U> p) {
return out << "(" << p.f << ", " << p.s << ")";
}
template <typename T, typename = decltype(begin(declval<T>()))>
typename enable_if<!is_same<T, string>::value, ostream&>::type operator<<(ostream& out, T x) {
string dlm = "";
out << "{";
for(auto i : x) {
out << dlm << i;
dlm = ", ";
}
return out << "}";
}
#include "Anna.h"
void Anna(int n, vector<char> s) {
char last = ' ';
vector<int> ans(n);
int z = 0;
for(int i = 0; i < n; i++) {
if(s[i] == 'Z') z = i;
}
for(int i = 0; i < z; i++) {
if(last == ' ' && s[i] == 'X') {
ans[i] = 2;
last = 'X';
} else if(last == 'Y' && s[i] == 'X') {
ans[i] = 2;
last = 'X';
} else if(last == 'Y' && s[i] == 'Z') {
ans[i] = 3;
last = 'X';
} else if(last == 'X' && s[i] == 'Y') {
ans[i] = 1;
last = 'Y';
}
}
if(last == ' ') return;
if(last == 'X') {
for(int i = z; i >= 0; i--) {
if(ans[i]) {
ans[i] = 0;
break;
}
}
}
ans[z] = 3;
for(auto i : ans) {
if(i >= 2) {
Send(1);
Send(i & 1);
} else {
Send(i);
}
}
}
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
// #define int long long
#define ll long long
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) [&](decltype(x) _x) {cerr << #x << " = " << _x << endl; return _x;}(x)
using pii = pair<int, int>;
const ll inf = 1ll << 60;
template <typename T, typename U>
ostream& operator<<(ostream& out, pair<T, U> p) {
return out << "(" << p.f << ", " << p.s << ")";
}
template <typename T, typename = decltype(begin(declval<T>()))>
typename enable_if<!is_same<T, string>::value, ostream&>::type operator<<(ostream& out, T x) {
string dlm = "";
out << "{";
for(auto i : x) {
out << dlm << i;
dlm = ", ";
}
return out << "}";
}
#include "Bruno.h"
void Bruno(int n, int l, vector<int> a) {
debug(a);
if(a.empty()) {
for(int i = 0; i < n; i++) {
Remove(i);
}
return;
}
string s;
int i = 0;
char last = 'Y';
while(i < a.size()) {
if(a[i]) {
if(last == 'Y') {
s.push_back(a[i + 1] ? 'Z' : 'X');
i += 2;
last = 'X';
} else {
s.push_back('Y');
i++;
last = 'Y';
}
} else {
s.push_back('.');
i++;
}
}
int z = 0;
for(int i = 0; i < n; i++) {
if(s[i] == 'Z') z = i;
}
for(int i = 0; i < n; i++) {
if(s[i] == '.') Remove(i);
}
int prv = 0;
for(int i = 0; i < n; i++) {
if(s[i] == '.') continue;
if(s[i] == 'Z' && i != z) {
Remove(prv);
Remove(i);
s[prv] = s[i] = '.';
}
prv = i;
}
prv = n - 1;
for(int i = n - 1; i >= 0; i--) {
if(s[i] == '.') continue;
if(s[i] == 'X') {
Remove(prv);
Remove(i);
s[prv] = s[i] = '.';
}
prv = i;
}
Remove(z);
}
Compilation message
Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:43:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | while(i < a.size()) {
| ~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
776 KB |
Output is correct |
2 |
Correct |
1 ms |
792 KB |
Output is correct |
3 |
Correct |
1 ms |
792 KB |
Output is correct |
4 |
Correct |
0 ms |
784 KB |
Output is correct |
5 |
Correct |
0 ms |
780 KB |
Output is correct |
6 |
Correct |
0 ms |
792 KB |
Output is correct |
7 |
Correct |
0 ms |
796 KB |
Output is correct |
8 |
Correct |
0 ms |
800 KB |
Output is correct |
9 |
Correct |
0 ms |
792 KB |
Output is correct |
10 |
Correct |
0 ms |
784 KB |
Output is correct |
11 |
Correct |
1 ms |
792 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
268 ms |
8756 KB |
Partially correct |
2 |
Partially correct |
242 ms |
9084 KB |
Partially correct |
3 |
Partially correct |
240 ms |
9084 KB |
Partially correct |
4 |
Partially correct |
230 ms |
9052 KB |
Partially correct |
5 |
Partially correct |
245 ms |
9116 KB |
Partially correct |
6 |
Partially correct |
232 ms |
9056 KB |
Partially correct |
7 |
Partially correct |
234 ms |
9012 KB |
Partially correct |
8 |
Partially correct |
255 ms |
9048 KB |
Partially correct |
9 |
Partially correct |
228 ms |
9092 KB |
Partially correct |
10 |
Partially correct |
230 ms |
9120 KB |
Partially correct |
11 |
Partially correct |
235 ms |
9092 KB |
Partially correct |
12 |
Partially correct |
234 ms |
9044 KB |
Partially correct |
13 |
Partially correct |
283 ms |
10016 KB |
Partially correct |
14 |
Partially correct |
285 ms |
9864 KB |
Partially correct |
15 |
Partially correct |
261 ms |
9900 KB |
Partially correct |
16 |
Partially correct |
245 ms |
9812 KB |
Partially correct |
17 |
Correct |
26 ms |
7516 KB |
Output is correct |
18 |
Correct |
26 ms |
7472 KB |
Output is correct |
19 |
Correct |
27 ms |
7512 KB |
Output is correct |
20 |
Partially correct |
288 ms |
9864 KB |
Partially correct |
21 |
Partially correct |
277 ms |
9952 KB |
Partially correct |
22 |
Partially correct |
197 ms |
9304 KB |
Partially correct |
23 |
Partially correct |
245 ms |
9804 KB |
Partially correct |
24 |
Partially correct |
279 ms |
9728 KB |
Partially correct |
25 |
Correct |
26 ms |
7496 KB |
Output is correct |
26 |
Correct |
26 ms |
7232 KB |
Output is correct |
27 |
Correct |
26 ms |
7292 KB |
Output is correct |
28 |
Correct |
26 ms |
7260 KB |
Output is correct |
29 |
Correct |
26 ms |
7508 KB |
Output is correct |
30 |
Correct |
28 ms |
7536 KB |
Output is correct |
31 |
Correct |
31 ms |
7500 KB |
Output is correct |
32 |
Partially correct |
263 ms |
9056 KB |
Partially correct |
33 |
Partially correct |
253 ms |
9096 KB |
Partially correct |