Submission #950740

# Submission time Handle Problem Language Result Execution time Memory
950740 2024-03-20T16:03:43 Z andrei_boaca Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
50 ms 8216 KB
#include "Anna.h"
#include <bits/stdc++.h>
#include <vector>

using namespace std;

namespace
{


}

void Anna(int N, std::vector<char> S)
{
    bool havex=0;
    for(int i=0;i<N;i++)
    {
        if(S[i]=='X')
        {
            if(!havex)
                Send(1);
            else
                Send(0);
            havex=1;
            continue;
        }
        if(!havex)
        {
            Send(0);
            continue;
        }
        if(S[i]=='Z'&&(i==N||S[i+1]=='Y'))
            Send(1);
        else
            Send(0);
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>
#include <vector>

using namespace std;

namespace
{


}

void Bruno(int N, int L, std::vector<int> A)
{
    vector<int> vals;
    int lft=-1;
    for(int i=0;i<A.size();i++)
        if(A[i]==1)
        {
            lft=i;
            break;
        }
    if(lft==-1)
    {
        for(int i=0;i<N;i++)
            Remove(i);
        return;
    }
    for(int i=0;i<lft;i++)
        Remove(i);
    for(int i=lft+1;i<A.size();i++)
        if(A[i]==1)
        {
            for(int j=i-1;A[j]==0;j--)
                Remove(j);
            Remove(i);
        }
    for(int i=L-1;A[i]==0;i--)
        Remove(i);
    Remove(lft);
}

Compilation message

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:17:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i=0;i<A.size();i++)
      |                 ~^~~~~~~~~
Bruno.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i=lft+1;i<A.size();i++)
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 780 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 8216 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -