# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1175890 | Zero_OP | Ancient Machine (JOI21_ancient_machine) | C++20 | 67 ms | 6592 KiB |
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
#define sz(v) (int)v.size()
#define pb push_back
using bigint = vector<int>; //reversed order
const int base = 2;
bigint operator + (bigint a, bigint b){
int n = max(sz(a), sz(b));
a.resize(n);
b.resize(n);
bigint c(n);
int carry = 0;
for(int i = 0; i < n; ++i){
c[i] = a[i] + b[i] + carry;
if(c[i] >= base){
carry = 1;
c[i] -= base;
} else carry = 0;
}
if(carry) c.pb(carry);
while(!c.empty() && c.back() == 0) c.pop_back();
return c;
}
void show(const bigint& n){
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |