#include "Anna.h"
#include<bits/stdc++.h>
using namespace std;
pair<int,int> encode(char c)
{
pair<int,int>res = {0,0};
if(c == 'X') res = {0,0};
if(c == 'Y') res = {0,1};
if(c == 'Z') res = {1,0};
return res;
}
void Anna(int N, std::vector<char> S)
{
for(int i = 0; i < N; i++)
{
pair<int,int> p = encode(S[i]);
Send(p.first);
Send(p.second);
}
}
#include "Bruno.h"
#include<bits/stdc++.h>
using namespace std;
char decode(pair<int,int> p)
{
if(p == make_pair(0,0)) return 'X';
if(p == make_pair(0,1)) return 'Y';
if(p == make_pair(1,0)) return 'Z';
}
const int MAXN = 1e5 + 5;
char s[MAXN];
void Bruno(int N, int L, std::vector<int> A)
{
for(int j = 0; j < A.size(); j += 2)
{
s[j/2 + 1] = decode({A[j],A[j+1]});
}
queue<int>q;
vector<int>br;
for(int i = 1; i <= N; i++)
{
if(br.size() % 2 == 0 && s[i] == 'X') br.push_back(i);
else if(br.size() % 2 == 1 && s[i] == 'Y') br.push_back(i);
else if(s[i] == 'Z')
{
while(!q.empty())
{
Remove(q.front() - 1);
q.pop();
}
while(br.size() >= 2)
{
Remove(br.back() - 1);
br.pop_back();
}
Remove(i-1);
}
else q.push(i);
}
while(!q.empty())
{
Remove(q.front() - 1);
q.pop();
}
while(br.size() >= 1)
{
Remove(br.back() - 1);
br.pop_back();
}
}
Compilation message (stderr)
# 2번째 컴파일 단계
Bruno.cpp: In function 'char decode(std::pair<int, int>)':
Bruno.cpp:10:1: warning: control reaches end of non-void function [-Wreturn-type]
10 | }
| ^| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |