# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
70560 | Talant | Broken Device (JOI17_broken_device) | C++17 | 6 ms | 1400 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |