# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
935548 | steveonalex | Ancient Machine (JOI21_ancient_machine) | C++17 | 77 ms | 9740 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |