제출 #935548

#제출 시각아이디문제언어결과실행 시간메모리
935548steveonalexAncient Machine (JOI21_ancient_machine)C++17
40 / 100
77 ms9740 KiB
#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){ while(S.size() % 5) S.push_back('X'); for(int i = 0; i<S.size(); i+= 5){ int current_number = 0; for(int j = i + 4; j>= i; --j){ current_number = current_number * 3 + (S[j] - 'X'); } for(int j = 0; j<8; ++j){ Send(current_number % 2); current_number /= 2; } } } // 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; vector<int> a; n = N; for(int i = 0; i<L; i += 8){ int current_num = 0; for(int j = i + 7; j>=i; --j){ current_num = current_num * 2 + A[j]; } for(int j = 0; j < 5; ++j) { a.push_back(current_num % 3); current_num /= 3; } } while(a.size() > N) a.pop_back(); int idx= -1; for(int i = 0; i<n; ++i){ if (a[i] == 0) { idx = i; break; } Remove(i); } if (idx == -1) return; int l = idx + 1; for(int i = idx + 1; i<n; ++i) if (a[i] == 2){ for(int j = i-1; j>=l; --j) Remove(j); Remove(i); l = i + 1; } for(;l<n; ++l) Remove(l); Remove(idx); } // int main(void){ // Bruno(6, 16, {0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0}); // return 0; // }

컴파일 시 표준 에러 (stderr) 메시지

Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:54:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     for(int i = 0; i<S.size(); i+= 5){
      |                    ~^~~~~~~~~

Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:70:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   70 |     while(a.size() > N) a.pop_back();
      |           ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...