답안 #935562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
935562 2024-02-29T09:13:29 Z steveonalex Ancient Machine (JOI21_ancient_machine) C++17
70 / 100
48 ms 8680 KB
#include <bits/stdc++.h>
#include "Anna.h"

using namespace std;

namespace Nigga{
typedef long long ll;
typedef unsigned long long ull;

#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ll mask){return __builtin_ctzll(mask);}
int logOf(ll mask){return __lg(mask);}

mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}

template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b) {a = b; return true;}
        return false;
    }

template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b) {a = b; return true;}
        return false;
    }

template <class T>
    void printArr(T& container, string separator = " ", string finish = "\n"){
        for(auto item: container) cout << item << separator;
        cout << finish;
    }


template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }
}


void Anna(int N, vector<char> S){
    int n = N;
    vector<int> a;
    for(int i = 0; i<n; ++i) a.push_back(S[i] - 'X');
    
    vector<bool> ans(n);
    int idx = -1;
    for(int i = 0; i<n; ++i) if (a[i] == 0){
        ans[i] = 1;
        idx = i;
        break;
    }

    if (idx != -1){
        for(int i = idx + 1; i<n; ++i) if (a[i] == 2 && (i == n - 1 || a[i+1] != 2)){
            ans[i] = 1;
        }
    }

    for(int i: ans) Send(i);
}

// int main(void){
//     return 0;
// }
#include <bits/stdc++.h>
#include "Bruno.h"

using namespace std;

namespace Ligma{
typedef long long ll;
typedef unsigned long long ull;

#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ll mask){return __builtin_ctzll(mask);}
int logOf(ll mask){return __lg(mask);}

mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}

template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b) {a = b; return true;}
        return false;
    }

template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b) {a = b; return true;}
        return false;
    }

template <class T>
    void printArr(T& container, string separator = " ", string finish = "\n"){
        for(auto item: container) cout << item << separator;
        cout << finish;
    }


template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

void Remove(int d){
	cout << d << "\n";
}

}

void Bruno(int N, int L, vector<int> A){
    int n = N;
    vector<int> pos;
    for(int i = 0; i<n; ++i) if (A[i] == 1) pos.push_back(i);

    if (pos.empty()){
    	for(int i = 0; i<n; ++i) Remove(i);
    	return;
    }
    for(int i = 1; i<pos.size(); ++i){
    	for(int j = pos[i] - 1; j > pos[i-1]; --j) Remove(j);
    	Remove(pos[i]);
    }
    for(int i = 0; i<=pos[0]; ++i) Remove(i);
   	for(int i = pos.back() + 1; i<n; ++i) Remove(i);
}


// int main(void){
//     Bruno(6, 16, {0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0});

//     return 0;
// }

Compilation message

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:65:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |     for(int i = 1; i<pos.size(); ++i){
      |                    ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 792 KB Output is correct
2 Correct 0 ms 792 KB Output is correct
3 Correct 0 ms 792 KB Output is correct
4 Correct 0 ms 780 KB Output is correct
5 Correct 0 ms 780 KB Output is correct
6 Correct 0 ms 792 KB Output is correct
7 Correct 0 ms 780 KB Output is correct
8 Correct 0 ms 792 KB Output is correct
9 Correct 1 ms 792 KB Output is correct
10 Correct 0 ms 792 KB Output is correct
11 Correct 0 ms 780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 47 ms 8432 KB Partially correct
2 Partially correct 40 ms 8312 KB Partially correct
3 Partially correct 45 ms 8332 KB Partially correct
4 Partially correct 41 ms 8388 KB Partially correct
5 Partially correct 44 ms 8396 KB Partially correct
6 Partially correct 43 ms 8356 KB Partially correct
7 Partially correct 45 ms 8400 KB Partially correct
8 Partially correct 41 ms 8288 KB Partially correct
9 Partially correct 41 ms 8344 KB Partially correct
10 Partially correct 42 ms 8352 KB Partially correct
11 Partially correct 40 ms 8352 KB Partially correct
12 Partially correct 45 ms 8212 KB Partially correct
13 Partially correct 45 ms 8416 KB Partially correct
14 Partially correct 46 ms 8320 KB Partially correct
15 Partially correct 41 ms 8372 KB Partially correct
16 Partially correct 44 ms 8404 KB Partially correct
17 Partially correct 46 ms 8444 KB Partially correct
18 Partially correct 44 ms 8508 KB Partially correct
19 Partially correct 46 ms 8248 KB Partially correct
20 Partially correct 41 ms 8384 KB Partially correct
21 Partially correct 41 ms 8408 KB Partially correct
22 Partially correct 46 ms 8472 KB Partially correct
23 Partially correct 40 ms 8352 KB Partially correct
24 Partially correct 40 ms 8328 KB Partially correct
25 Partially correct 45 ms 8456 KB Partially correct
26 Partially correct 47 ms 8680 KB Partially correct
27 Partially correct 48 ms 8332 KB Partially correct
28 Partially correct 46 ms 8516 KB Partially correct
29 Partially correct 45 ms 8428 KB Partially correct
30 Partially correct 44 ms 8480 KB Partially correct
31 Partially correct 47 ms 8444 KB Partially correct
32 Partially correct 40 ms 8444 KB Partially correct
33 Partially correct 41 ms 8356 KB Partially correct