# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64224 | zadrga | Broken Device (JOI17_broken_device) | C++14 | 570 ms | 21552 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>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 1000111
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
vector<int> v, block;
int arr[maxn];
void Anna(int N, long long X, int K, int P[]){
// cout << N << " " << X << " " << K<< endl;
v.clear(); block.clear();
memset(arr, 0, sizeof(arr));
for(int i = 0; i < 60; i++){
if((X >> i) & 1)
v.pb(1);
else
v.pb(0);
}
block.pb(-1);
for(int i = 0; i < K; i++)
block.pb(P[i]);
block.pb(N + 1);
memset(arr, 0, sizeof(arr));
int ind = 0;
for(int i = 1; i < block.size(); i++){
int x = block[i - 1] + 1;
while(ind < v.size() && block[i] - x >= 3){
arr[x++] = 1;
arr[x++] = v[ind++];
arr[x++] = v[ind++];
}
}
for(int i = 0; i < N; i++){
Set(i, arr[i]);
// cout << i << " "<< arr[i] << endl;
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 1000111
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
vector<int> v1;
long long Bruno( int N, int A[]){
v1.clear();
for(int i = 0; i < N; i++){
if(A[i] == 1){
v1.pb(A[i + 1]);
v1.pb(A[i + 2]);
i += 2;
}
}
ll ret = 0;
for(int i = 0; i < v1.size(); i++)
ret += (1 << i) * v1[i];
// cout << ret << endl;
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |