Submission #935552

# Submission time Handle Problem Language Result Execution time Memory
935552 2024-02-29T09:07:11 Z Boycl07 Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
34 ms 7628 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 1; i <= n; ++i)
#define forn(i, l, r) for(int i = l; i <= r; ++i)
#define ford(i, r, l) for(int i = r; i >= l; --i)
#define FOR(i, n) for(int i = 0; i < n; ++i)
#define FORD(i, n) for(int i = n - 1; i >= 0; --i)
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define endl "\n"
#define task "skycrapers"
#define sz(a) int(a.size())
#define C(x, y) make_pair(x, y)
#define all(a) (a).begin(), (a).end()
#define bit(i, mask) (mask >> i & 1)

void Anna(int N, std::vector<char> S);

void Send(int a);


void Anna(int n, vector<char> S)
{
    bool flag = 0;
    int idx = 0;
    while(idx < n && S[idx] != 'X') Send(0), ++idx;
    Send(1); ++idx;
    while(idx < n)
    {
        if(S[idx] == 'Z') Send(1);
        else Send(0);
        ++idx;
    }
}



#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 1; i <= n; ++i)
#define forn(i, l, r) for(int i = l; i <= r; ++i)
#define ford(i, r, l) for(int i = r; i >= l; --i)
#define FOR(i, n) for(int i = 0; i < n; ++i)
#define FORD(i, n) for(int i = n - 1; i >= 0; --i)
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define endl "\n"
#define task "skycrapers"
#define sz(a) int(a.size())
#define C(x, y) make_pair(x, y)
#define all(a) (a).begin(), (a).end()
#define bit(i, mask) (mask >> i & 1)


void Bruno(int N, int L, std::vector<int> A);

void Remove(int d);


void Bruno(int n, int Len, vector<int> A)
{
    int first = 0;
    while(first < n && A[first] != 1)
        Remove(first++);
    if(first == Len) return;
    for(int i = first + 1; i < n; ++i)
    {
        int j = i;
        while(j < n && A[j] != 1) ++j;
        ford(k, j - 1, i) Remove(k);
        Remove(j);
        i = j;
    }

    Remove(first);
}

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:30:10: warning: unused variable 'flag' [-Wunused-variable]
   30 |     bool flag = 0;
      |          ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 788 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 7628 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -