답안 #475363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
475363 2021-09-22T07:38:40 Z balbit Ancient Machine (JOI21_ancient_machine) C++17
70 / 100
93 ms 8504 KB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define y1 zck_is_king
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define SQ(x) (x)*(x)
#define MN(a,b) a = min(a,(__typeof__(a))(b))
#define MX(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define REP(i,n) for (int i = 0; i<n; ++i)
#define RREP(i,n) for (int i = n-1; i>=0; --i)
#define REP1(i,n) for (int i = 1; i<=n; ++i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#ifdef BALBIT
#define IOS()
#define bug(...) fprintf(stderr,"#%d (%s) = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define bug(...)
#endif






namespace {

const int maxn = 1e5+5;
const int iinf = 1e9+10;
const ll inf = 1ll<<60;
const ll mod = 1e9+7 ;
int variable_example = 0;

}

void Anna(int n, std::vector<char> S) {
    vector<int> ret(n);
    bool zed = 0;
    for (int i = n-1; i>=0; --i) {
        if (S[i] == 'Z' && !zed) {
            ret[i] = 1; zed = 1;
        }
        else if (S[i] == 'X' && zed && (i==0 || S[i-1] != 'X')) {
            ret[i] = 1;
        }
    }
    REP(i,n) {
        Send(ret[i]);
    }
}




#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define y1 zck_is_king
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define SQ(x) (x)*(x)
#define MN(a,b) a = min(a,(__typeof__(a))(b))
#define MX(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define REP(i,n) for (int i = 0; i<n; ++i)
#define RREP(i,n) for (int i = n-1; i>=0; --i)
#define REP1(i,n) for (int i = 1; i<=n; ++i)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#ifdef BALBIT
#define IOS()
#define bug(...) fprintf(stderr,"#%d (%s) = ",__LINE__,#__VA_ARGS__),_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define bug(...)
#endif



namespace {

const int iinf = 1e9+10;
const ll inf = 1ll<<60;
const ll mod = 1e9+7 ;

const int maxn = 1e5+5;
int variable_example = 0;

int FunctionExample(int P) { return 1 - P; }

}  // namespace

void Bruno(int n, int L, std::vector<int> A) {

    int zpos = -1;
    if (*max_element(ALL(A)) == 0) {
        REP(i,n) {
            Remove(i);
        }
        return;
    }
    for (int i = n-1; i>=0; --i) {
        if (A[i] == 1) {
            zpos = i;
            break;
        }else{
            Remove(i);
        }
    }
    int prv = zpos;
    for (int i = zpos-1; i>=0; --i) {
        if (A[i] == 1 || i == 0) {
            // met an x
            for (int j = i+1; j<prv; ++j) {
                Remove(j);
            }
            Remove(i);
            prv = i;
        }
    }
    Remove(zpos);
}

Compilation message

Anna.cpp:42:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   42 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~

Bruno.cpp:42:5: warning: 'int {anonymous}::FunctionExample(int)' defined but not used [-Wunused-function]
   42 | int FunctionExample(int P) { return 1 - P; }
      |     ^~~~~~~~~~~~~~~
Bruno.cpp:40:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   40 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 484 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 1 ms 488 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 1 ms 492 KB Output is correct
6 Correct 1 ms 488 KB Output is correct
7 Correct 1 ms 488 KB Output is correct
8 Correct 1 ms 488 KB Output is correct
9 Correct 1 ms 616 KB Output is correct
10 Correct 1 ms 512 KB Output is correct
11 Correct 1 ms 488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 70 ms 8488 KB Partially correct
2 Partially correct 63 ms 8492 KB Partially correct
3 Partially correct 63 ms 8376 KB Partially correct
4 Partially correct 67 ms 8456 KB Partially correct
5 Partially correct 64 ms 8432 KB Partially correct
6 Partially correct 64 ms 8304 KB Partially correct
7 Partially correct 64 ms 8472 KB Partially correct
8 Partially correct 64 ms 8416 KB Partially correct
9 Partially correct 62 ms 8460 KB Partially correct
10 Partially correct 62 ms 8448 KB Partially correct
11 Partially correct 61 ms 8364 KB Partially correct
12 Partially correct 62 ms 8340 KB Partially correct
13 Partially correct 81 ms 8460 KB Partially correct
14 Partially correct 69 ms 8392 KB Partially correct
15 Partially correct 74 ms 8288 KB Partially correct
16 Partially correct 72 ms 8456 KB Partially correct
17 Partially correct 68 ms 8460 KB Partially correct
18 Partially correct 68 ms 8472 KB Partially correct
19 Partially correct 69 ms 8400 KB Partially correct
20 Partially correct 61 ms 8460 KB Partially correct
21 Partially correct 68 ms 8364 KB Partially correct
22 Partially correct 73 ms 8432 KB Partially correct
23 Partially correct 61 ms 8480 KB Partially correct
24 Partially correct 62 ms 8248 KB Partially correct
25 Partially correct 73 ms 8464 KB Partially correct
26 Partially correct 82 ms 8460 KB Partially correct
27 Partially correct 70 ms 8440 KB Partially correct
28 Partially correct 69 ms 8492 KB Partially correct
29 Partially correct 73 ms 8472 KB Partially correct
30 Partially correct 93 ms 8496 KB Partially correct
31 Partially correct 70 ms 8332 KB Partially correct
32 Partially correct 64 ms 8504 KB Partially correct
33 Partially correct 65 ms 8452 KB Partially correct