# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70560 | Talant | Broken Device (JOI17_broken_device) | C++17 | 6 ms | 1400 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');
x /= 2;
}
return a;
}
int u[200];
int ind;
void Anna( int n, long long x, int k, int p[] ){
string s = bin(x);
memset(u,0,sizeof(u));
ind = 0;
for (int i = 0; i < k; i ++)
u[p[i]] = 1;
for (int i = 0; i < n; i ++) {
if (ind >= (int)s.size()) {
Set(i,0);
continue;
}
if (i + 1 < n && u[i] + u[i + 1] < 1) {
Set(i,1);
Set(i + 1,(int)(s[ind] - '0'));
ind ++;
i ++;
while (s[ind - 1] == '1' && s[ind] == '1' && ind < (int)s.size() && u[i + 1] == 0) {
Set(i + 1,(int)(s[ind] - '0'));
ind ++;
i ++;
}
i ++;
Set(i,0);
}
else {
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;
long long ans;
long long cnt;
long long Bruno( int N, int a[] ){
ans = 0;
cnt = 0;
for (int i = 0; i < N - 1; i ++) {
if (a[i] == 1) {
ans += (1ll << cnt) * 1ll * a[i + 1];
// cout << i + 1 << endl;
cnt ++;
i ++;
while (a[i] == 1 && a[i + 1] == 1 && i + 1 < N) {
ans += (1ll << cnt) * 1ll * a[i + 1];
// cout << i + 1 << endl;
cnt ++;
i ++;
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |