답안 #935468

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
935468 2024-02-29T07:28:22 Z quanlt206 Ancient Machine (JOI21_ancient_machine) C++17
0 / 100
32 ms 7688 KB
#include "Anna.h"
#include<bits/stdc++.h>
#define X first
#define Y second
#define all(x) begin(x), end(x)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, b, a) for(int i = (b); i >= (a); i--)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define mxx max_element
#define mnn min_element
#define SQR(x) (1LL * (x) * (x))
#define MASK(i) (1LL << (i))
#define Point Vector
#define left Left
#define right Right
#define div Div
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<db, db> pdb;
typedef pair<ld, ld> pld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
typedef pair<ll, int> pli;
typedef pair<ll, pii> plii;
 
template<class A, class B>
    bool maximize(A& x, B y) {
        if (x < y) return x = y, true; else return false;
    }
template<class A, class B>
    bool minimize(A& x, B y) {
        if (x > y) return x = y, true; else return false;
    }
/* END OF TEMPLATE */
 
const int N = 1e5 + 7;
 
int n, m;
void Anna(int n, vector<char> S) {
    bool kt = false;
    REP(i, 0, n)
        if (S[i] == 'X') {
            REP(j, 0, i) Send(0);
            Send(1);
            REP(j, i + 1, n)
                if (S[j] == 'Z') Send(1); else Send(0);
            return ;
        }
    REP(i, 0, n) Send(0);
}
#include "Bruno.h"
#include<bits/stdc++.h>
#define X first
#define Y second
#define all(x) begin(x), end(x)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, b, a) for(int i = (b); i >= (a); i--)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define mxx max_element
#define mnn min_element
#define SQR(x) (1LL * (x) * (x))
#define MASK(i) (1LL << (i))
#define Point Vector
#define left Left
#define right Right
#define div Div
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair<db, db> pdb;
typedef pair<ld, ld> pld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
typedef pair<ll, int> pli;
typedef pair<ll, pii> plii;
 
template<class A, class B>
    bool maximize(A& x, B y) {
        if (x < y) return x = y, true; else return false;
    }
template<class A, class B>
    bool minimize(A& x, B y) {
        if (x > y) return x = y, true; else return false;
    }
/* END OF TEMPLATE */
 
const int N = 1e5 + 7;
 
void Bruno(int n, int L, vector<int> A) {
    if (*mxx(all(A)) == 0) {
        REP(i, 0, n) Remove(i);
        return ;
    }
    int pos = -1;
    REP(i, 0, L)
        if (A[i] == 1) {
            pos = i;
            break;
        }
    REP(i, 0, pos) Remove(i);
    int i = pos;
    while (i < n) {
        if (i == n - 1) {
            Remove(i);
            break;
        }
        int j = i + 1;
        while (j < n && A[j] == 0) j++;
        if (j >= n) {
            REP(k, i + 1, n) Remove(k);
            i = n - 1;
            break;
        }
        FORD(k, j - 1, i + 1) Remove(k);
        if (i > pos) Remove(i);
        i = j;
    }
    if (pos != i) Remove(pos);
}

Compilation message

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:47:10: warning: unused variable 'kt' [-Wunused-variable]
   47 |     bool kt = false;
      |          ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 792 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 7688 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -