#include "Annalib.h"
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
void Anna( int N, long long X, int K, int P[] ){
vector<int>can(N,1);
for(int i=0;i<K;i++)can[P[i]]=0;
int cur=0,pos=1;
vector<int>need;
Set(0,0);
for(int i=0;i<60;i++){
long long x=(X&(1LL<<i));
need.pb(!!x);
}
int cnt=0;
for(auto i:need){
if(i==0){
while(pos<N&&can[pos]==0)Set(pos++,0);
if(pos>=N)break;
Set(pos++,1);
if(pos>=N)break;
Set(pos++,0);
}
else{
while(pos+1<N&&(!(can[pos+1]&&can[pos])))Set(pos++,0);
if(pos>=N)break;
Set(pos++,1);
if(pos>=N)break;
Set(pos++,1);
}
}
while(pos<N)Set(pos++,0);
}
/*
1
150 1152921504606846975 37
87 127 68 90 80 147 105 1 71 83 31 65 142 33 112 135 107 139 22 43 132 15 8 93 52 18 95 75 134 9 55 10 48 54 6 121 76
*/
#include "Brunolib.h"
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
long long Bruno( int N, int A[] ){
long long ans=0,cur=0;
for(int i=0;i<N;i++){
if(A[i]==1){
if(i+1<N&&A[i+1])ans+=(1LL<<cur),cur++,i++;
else cur++;
}
}
return ans;
}
/*
1
150 588064823 30
133 50 67 111 138 20 28 107 137 70 96 51 80 38 131 61 114 82 66 21 29 60 144 47 139 45 126 76 19 10
*/
Compilation message
Anna.cpp:33:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
33 | #pragma GCC optimize ("03,unroll-lopps")
| ^
Anna.cpp:34:47: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
34 | void Anna( int N, long long X, int K, int P[] ){
| ^
Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:37:7: warning: unused variable 'cur' [-Wunused-variable]
37 | int cur=0,pos=1;
| ^~~
Anna.cpp:44:7: warning: unused variable 'cnt' [-Wunused-variable]
44 | int cnt=0;
| ^~~
Bruno.cpp:33:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
33 | #pragma GCC optimize ("03,unroll-lopps")
| ^
Bruno.cpp:34:33: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
34 | long long Bruno( int N, int A[] ){
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
22 ms |
2756 KB |
Output is partially correct - L* = 15 |
2 |
Partially correct |
20 ms |
2832 KB |
Output is partially correct - L* = 16 |
3 |
Partially correct |
23 ms |
2784 KB |
Output is partially correct - L* = 16 |
4 |
Partially correct |
23 ms |
2852 KB |
Output is partially correct - L* = 16 |
5 |
Partially correct |
22 ms |
2780 KB |
Output is partially correct - L* = 17 |
6 |
Partially correct |
22 ms |
2884 KB |
Output is partially correct - L* = 17 |
7 |
Partially correct |
23 ms |
2776 KB |
Output is partially correct - L* = 18 |
8 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 16 |
9 |
Partially correct |
26 ms |
2776 KB |
Output is partially correct - L* = 18 |
10 |
Partially correct |
22 ms |
2844 KB |
Output is partially correct - L* = 16 |
11 |
Partially correct |
25 ms |
2772 KB |
Output is partially correct - L* = 17 |
12 |
Partially correct |
23 ms |
2752 KB |
Output is partially correct - L* = 20 |
13 |
Partially correct |
20 ms |
2568 KB |
Output is partially correct - L* = 18 |
14 |
Partially correct |
20 ms |
2772 KB |
Output is partially correct - L* = 16 |
15 |
Partially correct |
23 ms |
2772 KB |
Output is partially correct - L* = 16 |
16 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 17 |
17 |
Partially correct |
22 ms |
2868 KB |
Output is partially correct - L* = 17 |
18 |
Partially correct |
23 ms |
2664 KB |
Output is partially correct - L* = 16 |
19 |
Partially correct |
22 ms |
2740 KB |
Output is partially correct - L* = 18 |
20 |
Partially correct |
20 ms |
2772 KB |
Output is partially correct - L* = 15 |
21 |
Partially correct |
20 ms |
2680 KB |
Output is partially correct - L* = 17 |
22 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 14 |
23 |
Partially correct |
22 ms |
2764 KB |
Output is partially correct - L* = 15 |
24 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 16 |
25 |
Partially correct |
24 ms |
2776 KB |
Output is partially correct - L* = 21 |
26 |
Partially correct |
22 ms |
2772 KB |
Output is partially correct - L* = 16 |
27 |
Partially correct |
20 ms |
2784 KB |
Output is partially correct - L* = 16 |
28 |
Partially correct |
26 ms |
2784 KB |
Output is partially correct - L* = 19 |
29 |
Partially correct |
20 ms |
2860 KB |
Output is partially correct - L* = 16 |
30 |
Partially correct |
20 ms |
2768 KB |
Output is partially correct - L* = 20 |
31 |
Partially correct |
22 ms |
2752 KB |
Output is partially correct - L* = 15 |
32 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 18 |
33 |
Partially correct |
23 ms |
2772 KB |
Output is partially correct - L* = 17 |
34 |
Partially correct |
22 ms |
2728 KB |
Output is partially correct - L* = 16 |
35 |
Partially correct |
20 ms |
2756 KB |
Output is partially correct - L* = 16 |
36 |
Partially correct |
22 ms |
2808 KB |
Output is partially correct - L* = 15 |
37 |
Partially correct |
20 ms |
2768 KB |
Output is partially correct - L* = 16 |
38 |
Partially correct |
20 ms |
2772 KB |
Output is partially correct - L* = 18 |
39 |
Partially correct |
20 ms |
2772 KB |
Output is partially correct - L* = 17 |
40 |
Partially correct |
25 ms |
2872 KB |
Output is partially correct - L* = 15 |