# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
959111 | Kavelmydex | Broken Device (JOI17_broken_device) | C++17 | 35 ms | 3176 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 ll long long
#define pi pair<int,int>
#define vi vector<int>
#define rep(i,x,n) for(int i=x; i<n; ++i)
#define For(i,n) rep(i,0,n)
#define endl "\n"
#define sp ' '
#define pb push_back
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()
const int N = 200, OO = 1e18, mod = 1e9+7, mx = 10;
void tr(int a, int b){cout << a << sp << b << endl;}
void cmx(int &a, int b){a = max(a,b);}
void cmn(int &a, int b){a = min(a,b);}
const int dx[]{0,0,-1,1}, dy[]{1,-1,0,0};
int mp[N], ans[N];
void Anna( int n, long long X, int K, int P[] ){
memset(mp,0,sizeof(mp)); memset(ans,0,sizeof(ans));
For(i,K){
mp[P[i]] = 1;
}
vi v;
For(i,60){
if((1LL<<i) & X){
v.pb(i);
}
}
for(int i=0; i<=89; ++i){
bool ok = 1;
for(int j=i; j<=i+60; ++j){
ok &= (!mp[j]);
}
if(ok){
ans[i] = 1;
for(int x: v){
ans[i+x+1] = 1;
}
break;
}
}
For(i,n){
Set(i,ans[i]);
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define vi vector<int>
#define rep(i,x,n) for(int i=x; i<n; ++i)
#define For(i,n) rep(i,0,n)
#define endl "\n"
#define sp ' '
#define pb push_back
#define f first
#define s second
#define sz size()
#define all(x) (x).begin(),(x).end()
const int N = 1e5+10, OO = 1e18, mod = 1e9+7, mx = 10;
const int dx[]{0,0,-1,1}, dy[]{1,-1,0,0};
long long Bruno( int N, int A[] ){
int fi = 0;
For(i,N){
if(A[i]) {
fi = i;
break;
}
}
ll ans = 0;
for(int i=fi+1; i+60<=N; ++i){
if(A[i]){
ans += (1LL<<(i-fi-1));
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |