# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
69958 | Talant | Broken Device (JOI17_broken_device) | C++17 | 79 ms | 13632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Annalib.h"
#include <bits/stdc++.h>
#define sc second
#define fr first
#define pb push_back
#define mk make_pair
using namespace std;
string bin(long long x) {
string a = "";
while(x) {
a = (char)(x % 2 + '0') + a;
x /= 2;
}
return a;
}
void Anna( int N, long long X, int K, int p[] ){
string s = bin(X);
if (p[0] > s.size()) {
for (int i = 0; i <= s.size(); i ++) {
if (i == 0) Set(i,1);
else {
Set(i,(int)(s[i - 1] - '0'));
}
}
for (int i = (int)(s.size()) + 1; i < N; i ++)
Set(i,0);
}
else {
int o = (N - (int)s.size() - 1);
for (int i = o; i < N; i ++) {
if (i == o) Set(i,1);
else {
Set(i,(int)(s[(int)s.size() - i + (o + 1) - 1] - '0'));
}
}
for (int i = 0; i < o; i ++) Set(i,0);
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
#define sc second
#define fr first
#define pb push_back
#define mk make_pair
using namespace std;
int id;
long long ans;
long long Bruno( int N, int A[] ){
for (int i = 0; i < N; i ++) {
if (A[i]) {
id = i + 1;
break;
}
}
for (int i = id; i < N; i ++) {
ans += (1 << (i - id)) * A[i];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |